test: add command palette and fuzzy match tests
Tests for CommandPalette component (rendering, filtering, keyboard navigation, grouped results, shortcuts display), useCommandRegistry hook (contextual actions, archive toggle, git availability), fuzzyMatch utility, and Cmd+K shortcut. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -17,6 +17,7 @@ function fireKey(key: string, mods: { altKey?: boolean; metaKey?: boolean; ctrlK
|
||||
function makeActions() {
|
||||
return {
|
||||
onQuickOpen: vi.fn(),
|
||||
onCommandPalette: vi.fn(),
|
||||
onCreateNote: vi.fn(),
|
||||
onSave: vi.fn(),
|
||||
onOpenSettings: vi.fn(),
|
||||
@@ -86,4 +87,11 @@ describe('useAppKeyboard', () => {
|
||||
fireKey('4', { altKey: true })
|
||||
expect(actions.onSetViewMode).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('Cmd+K triggers command palette', () => {
|
||||
const actions = makeActions()
|
||||
renderHook(() => useAppKeyboard(actions))
|
||||
fireKey('k', { metaKey: true })
|
||||
expect(actions.onCommandPalette).toHaveBeenCalled()
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user