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:
maoyingjie
2026-10-25 17:46:32 +08:00
parent 5e688680e9
commit 3e9be13b19
40 changed files with 634 additions and 225 deletions
+22
View File
@@ -64,6 +64,28 @@ describe("Autocomplete docs and demos", () => {
}
});
it("uses the baseline search field shell and empty state in every demo", () => {
for (const name of previews) {
const source = readFileSync(
`apps/docs/demos/autocomplete-${name}.vue`,
"utf8",
);
// Upstream renders SearchField autoFocus name="search" variant="secondary"
// with a clear button; the popover filter must keep that whole shell.
const fields = [...source.matchAll(/<SearchField\b[^>]*>/g)];
expect(fields.length, name).toBeGreaterThan(0);
for (const [tag] of fields) {
expect(tag, name).toMatch(/\bvariant="secondary"/);
expect(tag, name).toMatch(/\bname="search"/);
expect(tag, name).toMatch(/\bauto-focus/);
}
expect(source, name).toContain("SearchFieldClearButton");
// The ported .hv-empty-state padding must not be overridden per demo.
expect(source, name).not.toMatch(/<EmptyState\s+class=/);
expect(source, name).not.toContain("alert(");
}
});
it("documents Vue props instead of React ones", () => {
const document = readFileSync(
"apps/docs/components/autocomplete.md",