fix(web): search 503 vs error (#34); terms/authorities list error states (#31); authority-tab a11y + dead keys (#32); authority-kind test (#37)
This commit is contained in:
@@ -43,6 +43,27 @@ test("creates a text field — posts the body and clears the key input", async (
|
||||
await waitFor(() => expect(screen.getByLabelText(/^key$/i)).toHaveValue(""));
|
||||
});
|
||||
|
||||
test("selecting Authority reveals the kind picker and posts the chosen kind", async () => {
|
||||
let body: { authority_kind: string | null } | undefined;
|
||||
|
||||
server.use(
|
||||
http.post("/api/admin/field-definitions", async ({ request }) => {
|
||||
body = (await request.json()) as { authority_kind: string | null };
|
||||
return HttpResponse.json({ key: "maker" }, { status: 201 });
|
||||
}),
|
||||
);
|
||||
renderApp(tree(), { route: "/fields" });
|
||||
|
||||
await userEvent.type(screen.getByLabelText(/^key$/i), "maker");
|
||||
await userEvent.type(screen.getByLabelText(/label \(en\)/i), "Maker");
|
||||
await userEvent.selectOptions(screen.getByLabelText(/^type$/i), "authority");
|
||||
const kind = await screen.findByLabelText(/authority kind/i);
|
||||
await userEvent.selectOptions(kind, "person");
|
||||
await userEvent.click(screen.getByRole("button", { name: /create field/i }));
|
||||
|
||||
await waitFor(() => expect(body?.authority_kind).toBe("person"));
|
||||
});
|
||||
|
||||
test("selecting Term reveals the vocabulary picker and blocks submit until chosen", async () => {
|
||||
let posted = false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user