This commit is contained in:
@@ -39,6 +39,17 @@ beforeEach(() => {
|
||||
});
|
||||
afterEach(() => vi.restoreAllMocks());
|
||||
|
||||
test("uses short Admin buttons while keeping management in page titles", async () => {
|
||||
renderShell();
|
||||
await screen.findByRole("textbox", { name: /new question/i });
|
||||
await userEvent.click(screen.getByRole("button", { name: "Administration" }));
|
||||
for (const [label, title] of [["Workspace", "Workspace"], ["Evidence", "Evidence"], ["Memory", "Memory"], ["Database", "Database"], ["Pi configuration", "Pi"]]) {
|
||||
await userEvent.click(screen.getByRole("button", { name: label }));
|
||||
expect(await screen.findByRole("main", { name: `${title} management` })).toBeVisible();
|
||||
expect(screen.queryByRole("button", { name: `${title} management` })).not.toBeInTheDocument();
|
||||
}
|
||||
});
|
||||
|
||||
test.each(["Workspace", "Evidence", "Memory", "Database", "Pi"])("reloads the %s route as a full page", async name => {
|
||||
window.history.replaceState({ portal: "kept" }, "", `/portal?lang=it&thoth_route=administration/${name.toLowerCase()}#host`);
|
||||
renderShell();
|
||||
@@ -52,8 +63,8 @@ test("preserves host state and query parameters through Back and Forward", async
|
||||
window.history.replaceState({ portal: { view: "thoth" } }, "", "/portal?lang=it#host");
|
||||
renderShell();
|
||||
await userEvent.click(screen.getByRole("button", { name: "Administration" }));
|
||||
await userEvent.click(screen.getByRole("button", { name: "Workspace management" }));
|
||||
await userEvent.click(screen.getByRole("button", { name: "Pi management" }));
|
||||
await userEvent.click(screen.getByRole("button", { name: "Workspace" }));
|
||||
await userEvent.click(screen.getByRole("button", { name: "Pi configuration" }));
|
||||
act(() => window.history.back());
|
||||
expect(await screen.findByRole("main", { name: "Workspace management" })).toBeVisible();
|
||||
act(() => window.history.forward());
|
||||
@@ -75,8 +86,8 @@ test.each(["workspace", "database", "memory", "evidence", "pi"])("denies a direc
|
||||
test("Back and Core navigation preserve a Memory draft until the editor cancels it", async () => {
|
||||
renderShell();
|
||||
await userEvent.click(screen.getByRole("button", { name: "Administration" }));
|
||||
await userEvent.click(screen.getByRole("button", { name: "Workspace management" }));
|
||||
await userEvent.click(screen.getByRole("button", { name: "Memory management" }));
|
||||
await userEvent.click(screen.getByRole("button", { name: "Workspace" }));
|
||||
await userEvent.click(screen.getByRole("button", { name: "Memory" }));
|
||||
const page = await screen.findByRole("main", { name: "Memory management" });
|
||||
await userEvent.click(await within(page).findByRole("button", { name: "New card" }));
|
||||
await userEvent.type(within(page).getByLabelText("Title"), "Keep this draft");
|
||||
@@ -122,7 +133,7 @@ test("option A has one collapsible global context and preserves the Core draft a
|
||||
await userEvent.click(screen.getByRole("button", { name: "Done" }));
|
||||
expect(screen.queryByRole("combobox", { name: "Model" })).not.toBeInTheDocument();
|
||||
await userEvent.click(screen.getByRole("button", { name: "Administration" }));
|
||||
await userEvent.click(screen.getByRole("button", { name: "Memory management" }));
|
||||
await userEvent.click(screen.getByRole("button", { name: "Memory" }));
|
||||
expect(await screen.findByRole("main", { name: "Memory management" })).toBeVisible();
|
||||
expect(screen.queryByRole("textbox", { name: /new question/i })).not.toBeInTheDocument();
|
||||
await userEvent.click(screen.getByRole("button", { name: "Return to session" }));
|
||||
|
||||
Reference in New Issue
Block a user