Skip to content

Commit 766b33b

Browse files
TheChampCopilot
andcommitted
Add sidebar issue 949 regression tests
Cover collapsed navigation tooltips on hover and focus and verify the Transactions item stays active for nested routes. Existing mobile drawer scroll locking remains covered. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 6848b41 commit 766b33b

1 file changed

Lines changed: 44 additions & 0 deletions

File tree

‎src/components/Sidebar.test.tsx‎

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,50 @@ describe("Sidebar", () => {
276276
});
277277
});
278278

279+
describe("issue #949 sidebar behavior", () => {
280+
beforeEach(() => {
281+
localStorage.setItem("sorokit-sidebar-collapsed", "true");
282+
});
283+
284+
it("shows the collapsed navigation tooltip on pointer hover", async () => {
285+
render(
286+
<Sidebar active="wallet" onNavigate={onNavigate} open={false} onClose={onClose} />,
287+
);
288+
const transactions = screen.getByRole("button", { name: "Transactions" });
289+
290+
fireEvent.pointerMove(transactions, { pointerType: "mouse" });
291+
292+
expect(await screen.findByRole("tooltip")).toHaveTextContent("Transactions");
293+
});
294+
295+
it("shows the collapsed navigation tooltip when focused by keyboard", async () => {
296+
render(
297+
<Sidebar active="wallet" onNavigate={onNavigate} open={false} onClose={onClose} />,
298+
);
299+
const transactions = screen.getByRole("button", { name: "Transactions" });
300+
301+
fireEvent.focus(transactions);
302+
303+
expect(await screen.findByRole("tooltip")).toHaveTextContent("Transactions");
304+
expect(transactions).toHaveAttribute("aria-describedby");
305+
});
306+
307+
it("highlights the Transactions item for a nested transaction route", () => {
308+
render(
309+
<Sidebar
310+
active="/transactions/123"
311+
onNavigate={onNavigate}
312+
open={false}
313+
onClose={onClose}
314+
/>,
315+
);
316+
317+
const transactions = screen.getByRole("button", { name: "Transactions" });
318+
expect(transactions).toHaveAttribute("aria-current", "page");
319+
expect(transactions.className).toContain("bg-surface-3");
320+
});
321+
});
322+
279323
describe("nav semantics and keyboard access (#550)", () => {
280324
const NAV_ITEMS = [
281325
"Wallet",

0 commit comments

Comments
 (0)