Commit c56e51f
committed
test(cortex): add comprehensive tests for CortexDesktopLayout
Add 39 tests covering all major functionality of CortexDesktopLayout:
- Rendering (7): component mounts, title bar, mode carousel, notifications,
approval dialog, children, root container styling
- Loading layout state from localStorage (10): default mode, load mode/
sidebarTab/sidebarWidth/chatState, width clamping, invalid values,
force IDE mode with active project
- VALID_SIDEBAR_TABS and factory handling (2): factory tab from localStorage,
factory nav click always opens sidebar
- handleNavItemClick (5): toggle collapse on active tab, switch tab with
sidebar open/collapsed, home switches to vibe mode, new dispatches
file:new event
- Mode switching (5): vibe/ide layout rendering, viewmode:change event,
folder:did-open switches to IDE and sets files sidebar
- Saving layout state to localStorage (3): mode, sidebarTab,
sidebarCollapsed persisted on change
- Event listeners (7): registration on mount verifies all 14 events,
cleanup on unmount uses behavioral verification (events stop being
handled after unmount), view:explorer/search/git/extensions open
correct sidebar tabs, sidebar:toggle toggles collapsed state
Uses waitForMount() helper for async onMount listener registration and
vi.waitFor() for reactive DOM updates. All mocks follow existing test
patterns (CortexActivityBar, CortexChatPanel).1 parent dbca84a commit c56e51f
File tree
1 file changed
+672
-0
lines changed- src/components/cortex/__tests__
1 file changed
+672
-0
lines changed
0 commit comments