diff --git a/ui/src/components/Layout.test.tsx b/ui/src/components/Layout.test.tsx index 43321ec4202..57c79b7f12e 100644 --- a/ui/src/components/Layout.test.tsx +++ b/ui/src/components/Layout.test.tsx @@ -334,6 +334,33 @@ describe("Layout", () => { await act(async () => { root.unmount(); }); }); + it("opens the peek when hovering a collapsed rail (positive control for the hover sim)", async () => { + mockSidebarState.collapsed = true; + const root = createRoot(container); + const queryClient = new QueryClient({ defaultOptions: { queries: { retry: false } } }); + await act(async () => { + root.render( + + + , + ); + }); + await flushReact(); + + const panel = [...container.querySelectorAll("div")].find( + (el) => el.className.includes("inset-y-0") && el.className.includes("overflow-hidden"), + ); + expect(panel).toBeTruthy(); + await act(async () => { + panel!.dispatchEvent(new MouseEvent("mouseover", { bubbles: true, relatedTarget: document.body })); + }); + await act(async () => { await new Promise((r) => setTimeout(r, 80)); }); + // A normal collapsed-rail hover (not just-collapsed) opens the peek. + expect(mockSetPeeking).toHaveBeenCalledWith(true); + + await act(async () => { root.unmount(); }); + }); + it("keeps the app sidebar and shows the settings sidebar in the secondary pane on settings routes", async () => { currentPathname = "/PAP/company/settings/access"; mockPluginSlots.slots = [