mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-28 18:22:40 +00:00
Allow keybind overwriting (#3393)
Co-authored-by: Benjamin Lu <templu1107@proton.me>
This commit is contained in:
@@ -264,4 +264,26 @@ describe('useKeybindingStore', () => {
|
||||
userNewKeybindings[0]
|
||||
)
|
||||
})
|
||||
|
||||
it('should replace the previous keybinding with a new one for the same combo and unset the old command', () => {
|
||||
const store = useKeybindingStore()
|
||||
|
||||
const oldKeybinding = new KeybindingImpl({
|
||||
commandId: 'command1',
|
||||
combo: { key: 'A', ctrl: true }
|
||||
})
|
||||
|
||||
store.addUserKeybinding(oldKeybinding)
|
||||
|
||||
const newKeybinding = new KeybindingImpl({
|
||||
commandId: 'command2',
|
||||
combo: { key: 'A', ctrl: true }
|
||||
})
|
||||
|
||||
store.updateKeybindingOnCommand(newKeybinding)
|
||||
|
||||
expect(store.keybindings).toHaveLength(1)
|
||||
expect(store.getKeybinding(newKeybinding.combo)?.commandId).toBe('command2')
|
||||
expect(store.getKeybindingsByCommandId('command1')).toHaveLength(0)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user