feat: redesign persisted session summaries
This commit is contained in:
@@ -183,6 +183,62 @@ test("opening the panel shows the session documents", async () => {
|
||||
expect(await screen.findByText("Domanda originale")).toBeInTheDocument();
|
||||
});
|
||||
|
||||
test("resizes the session summary to exactly 50% and persists pointer width independently", async () => {
|
||||
wrap();
|
||||
await userEvent.click(await screen.findByText("Attiva uno"));
|
||||
await screen.findByText("Domanda originale");
|
||||
|
||||
const shell = screen.getByTestId("app-shell");
|
||||
setContainerWidth(shell, 1600);
|
||||
const separator = screen.getByRole("separator", { name: /resize session summary/i });
|
||||
expect(separator).toHaveAttribute("aria-orientation", "vertical");
|
||||
expect(separator).toHaveAttribute("aria-valuemin", "320");
|
||||
expect(separator).toHaveAttribute("aria-valuemax", "800");
|
||||
expect(shell.style.getPropertyValue("--session-panel-width")).toBe("384px");
|
||||
|
||||
Object.assign(separator, {
|
||||
setPointerCapture: vi.fn(),
|
||||
releasePointerCapture: vi.fn(),
|
||||
hasPointerCapture: vi.fn(() => true),
|
||||
});
|
||||
fireEvent.pointerDown(separator, { pointerId: 2, clientX: 384 });
|
||||
fireEvent.pointerMove(separator, { pointerId: 2, clientX: 900 });
|
||||
fireEvent.pointerUp(separator, { pointerId: 2, clientX: 900 });
|
||||
|
||||
expect(shell.style.getPropertyValue("--session-panel-width")).toBe("800px");
|
||||
expect(localStorage.getItem("thothii:session-documents-panel-width")).toBe("800");
|
||||
expect(screen.getByRole("complementary", { name: /session summary/i })).toHaveClass(
|
||||
"w-[var(--session-panel-width)]",
|
||||
"max-w-[50%]",
|
||||
);
|
||||
expect(screen.queryByRole("separator", { name: /resize model activity/i })).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
test("supports keyboard session resizing and hides its divider when the split is unusable", async () => {
|
||||
localStorage.setItem("thothii:session-documents-panel-width", "448");
|
||||
wrap();
|
||||
await userEvent.click(await screen.findByText("Attiva uno"));
|
||||
await screen.findByText("Domanda originale");
|
||||
|
||||
const shell = screen.getByTestId("app-shell");
|
||||
setContainerWidth(shell, 1200);
|
||||
const separator = screen.getByRole("separator", { name: /resize session summary/i });
|
||||
expect(shell.style.getPropertyValue("--session-panel-width")).toBe("448px");
|
||||
fireEvent.keyDown(separator, { key: "ArrowRight", shiftKey: true });
|
||||
expect(shell.style.getPropertyValue("--session-panel-width")).toBe("496px");
|
||||
fireEvent.keyDown(separator, { key: "End" });
|
||||
expect(shell.style.getPropertyValue("--session-panel-width")).toBe("600px");
|
||||
fireEvent.keyDown(separator, { key: "Home" });
|
||||
expect(shell.style.getPropertyValue("--session-panel-width")).toBe("320px");
|
||||
|
||||
setContainerWidth(shell, 800);
|
||||
expect(screen.queryByRole("separator", { name: /resize session summary/i })).not.toBeInTheDocument();
|
||||
expect(screen.getByRole("complementary", { name: /session summary/i })).toHaveClass(
|
||||
"w-[30vw]",
|
||||
"max-w-[30vw]",
|
||||
);
|
||||
});
|
||||
|
||||
test("clicking a session with a live runtime reconnects to its gate instead of the panel", async () => {
|
||||
let resumed: string | null = null;
|
||||
server.use(
|
||||
|
||||
Reference in New Issue
Block a user