Commit 8ebca52
committed
test(layout): add comprehensive tests for CortexSidebarContainer
Create CortexSidebarContainer.test.tsx with 45 tests across 8 describe blocks:
- Panel Rendering (18 tests): verify correct panel renders for each of 9
SidebarTab values (files, search, git, debug, extensions, agents, themes,
plugins, account) and no other panels render simultaneously. Uses async
findByTestId for lazy-loaded components with Suspense.
- Factory Panel Removal (2 tests): verify factory panel is not rendered for
any valid sidebar tab, confirming removal from expected tab set.
- Sidebar Width (3 tests): verify sidebarWidth prop applies correctly to
aside element style for various width values.
- Collapsed State (4 tests): verify aside, resize handle, and panel content
are hidden when sidebarCollapsed is true.
- Resize Handle (6 tests): full mousedown/mousemove/mouseup interaction
sequence including onResizingChange and onSidebarWidthChange callbacks,
and event listener cleanup after mouseup.
- Width Constraints (5 tests): verify SIDEBAR_MIN_WIDTH (200) and
SIDEBAR_MAX_WIDTH (600) clamping during resize drag.
- File Explorer Tab (5 tests): onFileSelect callback propagation, empty
state for null/"." projectPath, and Open Folder button rendering.
- Transition Behavior (2 tests): transition disabled during resize,
enabled otherwise.
All 10 lazy-loaded panel components are mocked via vi.mock(). All renders
use a Suspense wrapper as required by the lazy-loaded architecture.1 parent 585fdaa commit 8ebca52
File tree
1 file changed
+442
-0
lines changed- src/components/cortex/layout/__tests__
1 file changed
+442
-0
lines changed
0 commit comments