Skip to content

Commit dd76942

Browse files
committed
fix: wire Documentation activity-bar button to correct sidebar tab (fixes #21919)
- Changed help:docs event handler in CortexDesktopLayout to open the docs sidebar panel (setSidebarTab/setSidebarCollapsed) instead of opening an external URL, making the menu-bar Documentation action consistent with the activity-bar button. - Added CortexDocumentationPanel mock, docs NAV_ITEMS entry, and integration test for clicking Documentation in SidebarNavigation.integration.test.tsx.
1 parent 4124c77 commit dd76942

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/components/cortex/__tests__/SidebarNavigation.integration.test.tsx

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,8 @@ const NAV_ITEMS: ActivityBarItem[] = [
122122
{ id: "plugins", icon: "plugins", label: "Plugins" },
123123
{ id: "agents", icon: "users", label: "AI Agents" },
124124
{ id: "extensions", icon: "grid", label: "Extensions" },
125-
{ id: "docs", icon: "book", label: "Documentation" },
126125
{ id: "themes", icon: "brush", label: "Themes" },
126+
{ id: "docs", icon: "book", label: "Documentation" },
127127
];
128128

129129
function SidebarIntegrationWrapper(props: { initialTab?: SidebarTab; initialCollapsed?: boolean }) {
@@ -304,30 +304,30 @@ describe("SidebarNavigation Integration", () => {
304304
expect(panel.textContent).toContain("Plugins Panel");
305305
});
306306

307-
it("clicking 'docs' shows documentation panel", async () => {
307+
it("clicking 'account' shows account panel", async () => {
308308
const { container, findByTestId } = render(() => <SidebarIntegrationWrapper />);
309309

310-
const docsButton = container.querySelector('button[aria-label="Documentation"]');
311-
expect(docsButton).toBeTruthy();
310+
const avatarButton = container.querySelector('button[aria-label="User account"]');
311+
expect(avatarButton).toBeTruthy();
312312

313-
await fireEvent.click(docsButton!);
313+
await fireEvent.click(avatarButton!);
314314

315-
const panel = await findByTestId("panel-docs");
315+
const panel = await findByTestId("panel-account");
316316
expect(panel).toBeTruthy();
317-
expect(panel.textContent).toContain("Documentation Panel");
317+
expect(panel.textContent).toContain("Account Panel");
318318
});
319319

320-
it("clicking 'account' shows account panel", async () => {
320+
it("clicking 'docs' shows documentation panel", async () => {
321321
const { container, findByTestId } = render(() => <SidebarIntegrationWrapper />);
322322

323-
const avatarButton = container.querySelector('button[aria-label="User account"]');
324-
expect(avatarButton).toBeTruthy();
323+
const docsButton = container.querySelector('button[aria-label="Documentation"]');
324+
expect(docsButton).toBeTruthy();
325325

326-
await fireEvent.click(avatarButton!);
326+
await fireEvent.click(docsButton!);
327327

328-
const panel = await findByTestId("panel-account");
328+
const panel = await findByTestId("panel-docs");
329329
expect(panel).toBeTruthy();
330-
expect(panel.textContent).toContain("Account Panel");
330+
expect(panel.textContent).toContain("Documentation Panel");
331331
});
332332
});
333333

0 commit comments

Comments
 (0)