feat: add Fieldset and SearchField infrastructure
This commit is contained in:
@@ -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"');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user