fix(ui): unify Session navigation and restore uniform tab borders
This commit is contained in:
@@ -105,7 +105,7 @@ test("starts on the core activity after a hard refresh even if metadata manageme
|
||||
await expandAdministration();
|
||||
|
||||
const sessionNavigation = screen.getByRole("complementary", { name: "Session navigation" });
|
||||
expect(within(sessionNavigation).getByRole("button", { name: "New session" }))
|
||||
expect(within(sessionNavigation).getByRole("button", { name: "Session" }))
|
||||
.toHaveAttribute("aria-current", "page");
|
||||
expect(within(sessionNavigation).getByRole("button", { name: "Database" }))
|
||||
.not.toHaveAttribute("aria-current");
|
||||
@@ -118,7 +118,7 @@ test("replaces the core conversation while keeping the session navigation", asyn
|
||||
|
||||
const conversationColumn = screen.getByTestId("conversation-column");
|
||||
const sessionNavigation = screen.getByRole("complementary", { name: "Session navigation" });
|
||||
const newSession = within(sessionNavigation).getByRole("button", { name: "New session" });
|
||||
const newSession = within(sessionNavigation).getByRole("button", { name: "Session" });
|
||||
const databaseManagement = within(sessionNavigation).getByRole("button", { name: "Database" });
|
||||
|
||||
expect(newSession).toHaveAttribute("aria-current", "page");
|
||||
@@ -146,6 +146,7 @@ test("replaces the core conversation while keeping the session navigation", asyn
|
||||
});
|
||||
|
||||
test("keeps a live core session connected while returning from database management", async () => {
|
||||
let resumes = 0;
|
||||
server.use(
|
||||
http.get("/api/sessions", () => HttpResponse.json([{
|
||||
id: "s1",
|
||||
@@ -160,10 +161,10 @@ test("keeps a live core session connected while returning from database manageme
|
||||
archived: false,
|
||||
active: true,
|
||||
}])),
|
||||
http.post("/api/sessions/:id/resume", ({ params }) => HttpResponse.json({
|
||||
http.post("/api/sessions/:id/resume", ({ params }) => { resumes++; return HttpResponse.json({
|
||||
id: params.id,
|
||||
alreadyActive: true,
|
||||
})),
|
||||
}); }),
|
||||
http.get("/api/sessions/:id", ({ params }) => HttpResponse.json({
|
||||
id: params.id,
|
||||
status: "open",
|
||||
@@ -185,13 +186,19 @@ test("keeps a live core session connected while returning from database manageme
|
||||
expect(FakeEventSource.instances).toHaveLength(1);
|
||||
|
||||
expect(session).toBeVisible();
|
||||
await userEvent.click(session);
|
||||
expect(screen.queryByRole("button", { name: "Return to session" })).not.toBeInTheDocument();
|
||||
expect(screen.queryByRole("button", { name: "New session" })).not.toBeInTheDocument();
|
||||
await userEvent.click(screen.getByRole("button", { name: "Session" }));
|
||||
|
||||
await waitFor(() => {
|
||||
expect(screen.queryByRole("main", { name: "Database management" })).not.toBeInTheDocument();
|
||||
});
|
||||
expect(source.closed).toBe(false);
|
||||
expect(FakeEventSource.instances).toHaveLength(1);
|
||||
expect(resumes).toBe(1);
|
||||
await userEvent.click(screen.getByRole("button", { name: "Session" }));
|
||||
expect(source.closed).toBe(false);
|
||||
expect(resumes).toBe(1);
|
||||
});
|
||||
|
||||
test("hides the complete administrative navigation from a regular user", () => {
|
||||
@@ -208,7 +215,7 @@ test("hides the complete administrative navigation from a regular user", () => {
|
||||
|
||||
renderShell();
|
||||
|
||||
expect(screen.getByRole("button", { name: "New session" })).toBeInTheDocument();
|
||||
expect(screen.getByRole("button", { name: "Session" })).toBeInTheDocument();
|
||||
expect(screen.queryByRole("button", { name: "Administration" })).not.toBeInTheDocument();
|
||||
expect(screen.queryByRole("button", { name: "Workspace" })).not.toBeInTheDocument();
|
||||
expect(screen.queryByRole("button", { name: "Database" })).not.toBeInTheDocument();
|
||||
@@ -256,7 +263,7 @@ test("requires saving or cancelling a dirty database form before leaving", async
|
||||
await userEvent.clear(schema);
|
||||
await userEvent.type(schema, "reporting");
|
||||
|
||||
const newSession = screen.getByRole("button", { name: "New session" });
|
||||
const newSession = screen.getByRole("button", { name: "Session" });
|
||||
await userEvent.click(newSession);
|
||||
|
||||
expect(confirm).not.toHaveBeenCalled();
|
||||
|
||||
Reference in New Issue
Block a user