[Refactor] Simplify keybindingStore with _.groupBy (#2180)

This commit is contained in:
Chenlei Hu
2025-01-06 19:46:20 -05:00
committed by GitHub
parent ffb20b8789
commit 077ded2cce
2 changed files with 15 additions and 13 deletions

View File

@@ -33,6 +33,18 @@ describe('useKeybindingStore', () => {
expect(store.getKeybinding(keybinding.combo)).toEqual(keybinding)
})
it('should get keybindings by command id', () => {
const store = useKeybindingStore()
const keybinding = new KeybindingImpl({
commandId: 'test.command',
combo: { key: 'C', ctrl: true }
})
store.addDefaultKeybinding(keybinding)
expect(store.getKeybindingsByCommandId('test.command')).toEqual([
keybinding
])
})
it('should override default keybindings with user keybindings', () => {
const store = useKeybindingStore()
const defaultKeybinding = new KeybindingImpl({