feat: add Fieldset and SearchField infrastructure

This commit is contained in:
maoyingjie
2026-10-22 08:46:02 +08:00
parent 116056832c
commit a4fb3c550a
59 changed files with 3131 additions and 331 deletions
+34
View File
@@ -110,3 +110,37 @@ it("associates labels with explicit grouped control IDs on the server", async ()
expect(new Set(ids).size).toBe(ids.length);
for (const id of refs) expect(ids).toContain(id);
});
it("renders disabled fieldsets and search fields without browser globals", async () => {
const {
Fieldset,
FieldsetLegend,
SearchField,
SearchFieldGroup,
SearchFieldInput,
SearchFieldClearButton,
Label,
Description,
} = await import("../packages/vue/src");
const html = await renderToString(
createSSRApp({
render: () =>
h(Fieldset, { disabled: true }, () => [
h(FieldsetLegend, {}, () => h(Button, {}, () => "Exempt")),
h(SearchField, { defaultValue: "query", name: "q" }, () => [
h(Label, {}, () => "Query"),
h(SearchFieldGroup, {}, () => [
h(SearchFieldInput, { id: "ssr-search" }),
h(SearchFieldClearButton),
]),
h(Description, {}, () => "Hint"),
]),
]),
}),
);
expect(html).toContain('for="ssr-search"');
expect(html).toContain('type="search"');
expect(html).toContain('value="query"');
expect(html).toContain('data-slot="search-field-clear-button"');
expect(html).toContain('data-disabled="true"');
});