fix: complete field and OTP public contracts (HD-07)

This commit is contained in:
maoyingjie
2026-10-29 09:30:58 +08:00
parent 27cc62e36f
commit 2d7e3d4e1e
26 changed files with 1067 additions and 100 deletions
+37
View File
@@ -509,3 +509,40 @@ it.each(["changed-query", "x"])(
}
},
);
it("SearchField exposes value and shares field-level validation errors with Form", async () => {
const local = ref(["local search"]),
formErrors = ref({ q: "form search" });
const w = mount(
defineComponent({
render: () =>
h(Form, { validationErrors: formErrors.value }, () =>
h(
SearchField,
{ name: "q", validationErrors: local.value },
{
default: (s: { value: string }) => [
h(SearchFieldGroup, {}, () => h(SearchFieldInput)),
h(FieldError),
h("output", s.value),
],
},
),
),
}),
{ attachTo: document.body },
);
try {
await settle();
expect(w.get('[role="alert"]').text()).toBe("local search form search");
await w.get("input").setValue("query");
await settle();
expect(w.get("output").text()).toBe("query");
expect(w.find('[role="alert"]').exists()).toBe(false);
local.value = ["new search"];
await settle();
expect(w.get('[role="alert"]').text()).toBe("new search");
} finally {
w.unmount();
}
});