fix(web): vocab form-level error states, newVocabulary heading, id guard, EN-required test
This commit is contained in:
@@ -51,3 +51,18 @@ test("selecting a vocabulary shows its terms and adds one", async () => {
|
||||
expect((termBody as { labels: { label: string }[] })?.labels[0].label).toBe("Stone"),
|
||||
);
|
||||
});
|
||||
|
||||
test("add term without EN label shows required alert and does not POST", async () => {
|
||||
let posted = false;
|
||||
server.use(
|
||||
http.post("/api/admin/vocabularies/:id/terms", () => {
|
||||
posted = true;
|
||||
return HttpResponse.json({ id: "t-x" }, { status: 201 });
|
||||
}),
|
||||
);
|
||||
renderApp(tree(), { route: "/vocabularies/v-material" });
|
||||
expect(await screen.findByText("Bronze")).toBeInTheDocument();
|
||||
await userEvent.click(screen.getByRole("button", { name: /add term/i }));
|
||||
expect(screen.getByRole("alert")).toBeInTheDocument();
|
||||
expect(posted).toBe(false);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user