|
|
@@ -32,6 +32,25 @@ describe("command keybind helpers", () => {
|
|
|
expect(matchKeybind(keybinds, new KeyboardEvent("keydown", { key: ",", ctrlKey: true, altKey: true }))).toBe(false)
|
|
|
})
|
|
|
|
|
|
+ test("matchKeybind supports bracket keys", () => {
|
|
|
+ const keybinds = parseKeybind("mod+alt+[, mod+alt+]")
|
|
|
+ const prev = keybinds[0]
|
|
|
+ const next = keybinds[1]
|
|
|
+
|
|
|
+ expect(
|
|
|
+ matchKeybind(
|
|
|
+ keybinds,
|
|
|
+ new KeyboardEvent("keydown", { key: "[", ctrlKey: prev?.ctrl, metaKey: prev?.meta, altKey: true }),
|
|
|
+ ),
|
|
|
+ ).toBe(true)
|
|
|
+ expect(
|
|
|
+ matchKeybind(
|
|
|
+ keybinds,
|
|
|
+ new KeyboardEvent("keydown", { key: "]", ctrlKey: next?.ctrl, metaKey: next?.meta, altKey: true }),
|
|
|
+ ),
|
|
|
+ ).toBe(true)
|
|
|
+ })
|
|
|
+
|
|
|
test("formatKeybind returns human readable output", () => {
|
|
|
const display = formatKeybind("ctrl+alt+arrowup")
|
|
|
|