Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

test(help): find the fold toggle inside its own row in the switcher

Mauriced3a9e00752f1
diff --git a/client/src/components/Help/HelpPanel.test.tsx b/client/src/components/Help/HelpPanel.test.tsx
index 2e330290c..4fc78dae4 100644
--- a/client/src/components/Help/HelpPanel.test.tsx
+++ b/client/src/components/Help/HelpPanel.test.tsx
@@ -221,12 +221,15 @@ describe('HelpPanel', () => {
expect(list).toBeInTheDocument()
expect(screen.getByRole('option', { name: /Journal/ })).toHaveAttribute('aria-selected', 'true')
expect(screen.getByRole('option', { name: /Studio/ })).toBeInTheDocument()
- // Folding the group hides the sub-screens; the top-level screens stay.
- fireEvent.click(screen.getByRole('button', { name: '2 sub-screens' }))
+ // Folding the group hides the sub-screens; the top-level screens stay. The
+ // toggle is looked up inside its own row: every screen with sub-screens has
+ // one, and the trip has as many as the plan has columns, panels and tabs.
+ const journeyFold = () => within(screen.getByRole('option', { name: /^Journey/ })).getByRole('button', { name: /sub-screens/ })
+ fireEvent.click(journeyFold())
expect(screen.queryByRole('option', { name: /Studio/ })).toBeNull()
expect(screen.getByRole('option', { name: /Atlas/ })).toBeInTheDocument()
// Picking a sub-screen browses to it; the breadcrumb on the overview shows the trail.
- fireEvent.click(screen.getByRole('button', { name: '2 sub-screens' }))
+ fireEvent.click(journeyFold())
fireEvent.click(screen.getByRole('option', { name: /Studio/ }).querySelector('button')!)
expect(useHelpStore.getState().browseId).toBe('journey-studio')
expect(screen.getByRole('heading', { level: 1, name: 'Studio' })).toBeInTheDocument()