fix(pickers): repair data-slot selectors and align demos with the baseline
The CSS port prefixed data-slot attribute values with hv-, so the compiled selectors never matched the DOM and the ComboBox trigger chevron never rotated. Only class names get the prefix; slot values stay byte-identical. Also commit typed text as the value when allowsCustomValue finds no record, restore the baseline search-field shell in all 24 Autocomplete demos, and correct both doc pages against the pinned upstream sources.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
import { mount } from "@vue/test-utils";
|
||||
import { readFileSync } from "node:fs";
|
||||
import { defineComponent, h, nextTick, ref, type Component } from "vue";
|
||||
import {
|
||||
Autocomplete,
|
||||
@@ -664,3 +665,31 @@ describe("Autocomplete composition", () => {
|
||||
expect(valueText()).toBe("选择州/省");
|
||||
});
|
||||
});
|
||||
|
||||
describe("Autocomplete ported style hooks", () => {
|
||||
it("emits the data-slot values the ported CSS targets", async () => {
|
||||
const css = readFileSync(
|
||||
"packages/styles/components/autocomplete.css",
|
||||
"utf8",
|
||||
);
|
||||
|
||||
// Only class names carry the hv- prefix: data-slot values are a DOM
|
||||
// contract, so a prefixed value would leave the ported rules dead.
|
||||
expect(css).not.toMatch(/data-slot="hv-/);
|
||||
expect(css).toContain('&[data-slot="autocomplete-default-indicator"]');
|
||||
expect(css).toContain('[data-slot="autocomplete-clear-button-icon"]');
|
||||
|
||||
track(shell({ defaultValue: "texas" }));
|
||||
await nextTick();
|
||||
await settle();
|
||||
|
||||
expect(
|
||||
document.querySelector(
|
||||
'[data-slot="autocomplete-indicator"] [data-slot="autocomplete-default-indicator"]',
|
||||
),
|
||||
).not.toBeNull();
|
||||
expect(
|
||||
document.querySelector('[data-slot="autocomplete-clear-button-icon"]'),
|
||||
).not.toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user