Jelajahi Sumber

test(ui-sidebar): cover expanded search control

Hypatia May 2 bulan lalu
induk
melakukan
931e0e22c7
1 mengubah file dengan 8 tambahan dan 0 penghapusan
  1. 8 0
      packages/client/ui-sidebar/tests/sidebar-root.spec.tsx

+ 8 - 0
packages/client/ui-sidebar/tests/sidebar-root.spec.tsx

@@ -205,6 +205,14 @@ describe('SidebarRoot', () => {
     }
   })
 
+  it('expanded search control focuses the field 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 {