feat(ui): name controls and preserve modal state
This commit is contained in:
@@ -30,7 +30,8 @@ describe.each(["light", "dark"] as const)("%s loaded company workflow", mode =>
|
||||
if (outcome === "error") fail({ response: { status: 503 } });
|
||||
else finish({ data: outcome === "empty" ? [] : [company] });
|
||||
});
|
||||
expect(screen.queryByRole("status")).not.toBeInTheDocument();
|
||||
const status = screen.getByRole("status");
|
||||
expect(status).toHaveTextContent(outcome === "error" ? "" : "Content loaded.");
|
||||
if (outcome === "error") {
|
||||
const error = screen.getByRole("alert");
|
||||
expect(error).not.toBeEmptyDOMElement();
|
||||
@@ -45,7 +46,8 @@ describe.each(["light", "dark"] as const)("%s loaded company workflow", mode =>
|
||||
fireEvent.click(screen.getByRole("button", { name: `Edit: ${company.name}` }));
|
||||
expect(screen.getByRole("dialog")).toHaveAccessibleName();
|
||||
// Reading/editing a loaded form must not repeat the loading announcement or save.
|
||||
expect(screen.queryByRole("status")).not.toBeInTheDocument();
|
||||
expect(screen.getByRole("status", { hidden: true })).toBe(status);
|
||||
expect(status).toHaveTextContent("Content loaded.");
|
||||
} else {
|
||||
expect(screen.getByRole("table")).toHaveTextContent("No companies");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user