feat: migrate NumberField with form integration and docs

This commit is contained in:
maoyingjie
2026-10-23 11:48:06 +08:00
parent 7fc8315037
commit 23527d4e4c
43 changed files with 2788 additions and 9 deletions
+32
View File
@@ -567,3 +567,35 @@ it("renders Toolbar with nested groups without browser globals", async () => {
expect(html).toContain("hv-separator--horizontal");
expect(html).toContain('data-slot="button-group"');
});
it("renders NumberField in node with initial control associations and numeric submission", async () => {
const {
NumberField,
NumberFieldGroup,
NumberFieldInput,
Label,
Description,
} = await import("../packages/vue/src");
const html = await renderToString(
createSSRApp({
render: () =>
h(
NumberField,
{ defaultValue: 12.5, name: "amount", locale: "de-DE" },
() => [
h(Label, {}, () => "Amount"),
h(NumberFieldGroup, {}, () => [h(NumberFieldInput)]),
h(Description, {}, () => "Help"),
],
),
}),
);
expect(html).toContain('value="12,5"');
expect(html).toContain('name="amount"');
const inputId = html.match(/for="([^"]+)"/)?.[1];
expect(inputId).toBeTruthy();
expect(html).toContain(`id="${inputId}"`);
const descriptionId = html.match(/aria-describedby="([^"]+)"/)?.[1];
expect(descriptionId).toBeTruthy();
expect(html).toContain(`id="${descriptionId}"`);
});