fix: complete field and OTP public contracts (HD-07)
This commit is contained in:
@@ -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();
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user