8000 add test for elements that have uninstalled the hotkey handler · JavaScriptExpert/hotkey@d60f667 · GitHub
[go: up one dir, main page]

Skip to content

Commit d60f667

Browse files
committed
add test for elements that have uninstalled the hotkey handler
1 parent 8809047 commit d60f667

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

test/test.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,10 @@ describe('hotkey', function() {
5151
document.dispatchEvent(new KeyboardEvent('keydown', {key: 'b', ctrlKey: true}))
5252
assert.include(buttonsClicked, 'button3')
5353
})
54+
55+
it("doesn't trigger elements where the hotkey library has been uninstalled", function() {
56+
hotkey.uninstall(document.querySelector('#button1'))
57+
document.dispatchEvent(new KeyboardEvent('keydown', {key: 'b'}))
58+
assert.deepEqual(buttonsClicked, [])
59+
})
5460
})

0 commit comments

Comments
 (0)
0