@@ -1820,4 +1820,82 @@ describe("SettingsView Shortcuts", () => {
18201820 expect ( onClose ) . toHaveBeenCalledTimes ( 1 ) ;
18211821 } ) ;
18221822 } ) ;
1823+
1824+ it ( "filters shortcuts by search query" , async ( ) => {
1825+ render (
1826+ < SettingsView
1827+ workspaceGroups = { [ ] }
1828+ groupedWorkspaces = { [ ] }
1829+ ungroupedLabel = "Ungrouped"
1830+ onClose = { vi . fn ( ) }
1831+ onMoveWorkspace = { vi . fn ( ) }
1832+ onDeleteWorkspace = { vi . fn ( ) }
1833+ onCreateWorkspaceGroup = { vi . fn ( ) . mockResolvedValue ( null ) }
1834+ onRenameWorkspaceGroup = { vi . fn ( ) . mockResolvedValue ( null ) }
1835+ onMoveWorkspaceGroup = { vi . fn ( ) . mockResolvedValue ( null ) }
1836+ onDeleteWorkspaceGroup = { vi . fn ( ) . mockResolvedValue ( null ) }
1837+ onAssignWorkspaceGroup = { vi . fn ( ) . mockResolvedValue ( null ) }
1838+ reduceTransparency = { false }
1839+ onToggleTransparency = { vi . fn ( ) }
1840+ appSettings = { baseSettings }
1841+ openAppIconById = { { } }
1842+ onUpdateAppSettings = { vi . fn ( ) . mockResolvedValue ( undefined ) }
1843+ onRunDoctor = { vi . fn ( ) . mockResolvedValue ( createDoctorResult ( ) ) }
1844+ onUpdateWorkspaceCodexBin = { vi . fn ( ) . mockResolvedValue ( undefined ) }
1845+ onUpdateWorkspaceSettings = { vi . fn ( ) . mockResolvedValue ( undefined ) }
1846+ scaleShortcutTitle = "Scale shortcut"
1847+ scaleShortcutText = "Use Command +/-"
1848+ onTestNotificationSound = { vi . fn ( ) }
1849+ onTestSystemNotification = { vi . fn ( ) }
1850+ dictationModelStatus = { null }
1851+ onDownloadDictationModel = { vi . fn ( ) }
1852+ onCancelDictationDownload = { vi . fn ( ) }
1853+ onRemoveDictationModel = { vi . fn ( ) }
1854+ initialSection = "shortcuts"
1855+ /> ,
1856+ ) ;
1857+
1858+ const searchInput = screen . getByLabelText ( "Search shortcuts" ) ;
1859+ expect ( screen . getByText ( "Toggle terminal panel" ) ) . toBeTruthy ( ) ;
1860+ expect ( screen . getByText ( "Cycle model" ) ) . toBeTruthy ( ) ;
1861+
1862+ await act ( async ( ) => {
1863+ fireEvent . change ( searchInput , { target : { value : "navigation" } } ) ;
1864+ } ) ;
1865+ await waitFor ( ( ) => {
1866+ expect ( screen . getByText ( "Next workspace" ) ) . toBeTruthy ( ) ;
1867+ expect ( screen . queryByText ( "Toggle terminal panel" ) ) . toBeNull ( ) ;
1868+ } ) ;
1869+
1870+ await act ( async ( ) => {
1871+ fireEvent . change ( searchInput , { target : { value : "sidebars" } } ) ;
1872+ } ) ;
1873+ await waitFor ( ( ) => {
1874+ expect ( screen . getByText ( "Toggle projects sidebar" ) ) . toBeTruthy ( ) ;
1875+ expect ( screen . queryByText ( "Next workspace" ) ) . toBeNull ( ) ;
1876+ } ) ;
1877+
1878+ await act ( async ( ) => {
1879+ fireEvent . change ( searchInput , { target : { value : "new shortcut while focused" } } ) ;
1880+ } ) ;
1881+ await waitFor ( ( ) => {
1882+ expect ( screen . getByText ( "Cycle model" ) ) . toBeTruthy ( ) ;
1883+ expect ( screen . queryByText ( "Toggle terminal panel" ) ) . toBeNull ( ) ;
1884+ } ) ;
1885+
1886+ await act ( async ( ) => {
1887+ fireEvent . change ( searchInput , { target : { value : "no-such-shortcut" } } ) ;
1888+ } ) ;
1889+ await waitFor ( ( ) => {
1890+ expect ( screen . getByText ( 'No shortcuts match "no-such-shortcut".' ) ) . toBeTruthy ( ) ;
1891+ } ) ;
1892+
1893+ await act ( async ( ) => {
1894+ fireEvent . click ( screen . getByRole ( "button" , { name : "Clear" } ) ) ;
1895+ } ) ;
1896+ await waitFor ( ( ) => {
1897+ expect ( screen . getByText ( "Toggle terminal panel" ) ) . toBeTruthy ( ) ;
1898+ expect ( screen . queryByText ( 'No shortcuts match "no-such-shortcut".' ) ) . toBeNull ( ) ;
1899+ } ) ;
1900+ } ) ;
18231901} ) ;
0 commit comments