test(ui-sidebar): cover expanded search control

This commit is contained in:
Tianyi Cui
2026-07-23 14:30:43 +08:00
parent fe22e5e955
commit c5ebcef8af
@@ -205,6 +205,14 @@ describe('SidebarRoot', () => {
}
})
it('expanded search focuses without toggling the sidebar', () => {
const { onToggleSidebar } = mount(...projectData())
const input = screen.getByPlaceholderText('Search name, keywords...')
act(() => { fireEvent.click(screen.getByLabelText('Search sessions')) })
expect(document.activeElement).toBe(input)
expect(onToggleSidebar).not.toHaveBeenCalled()
})
it('the search query survives a collapse/expand round trip', () => {
vi.useFakeTimers()
try {