Skip to content

Commit 564ea42

Browse files
committed
Merge pull request #129 from burtonjc/master
making unbind work with multiple keys
2 parents 0f09fc1 + f198289 commit 564ea42

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

keymaster.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,9 @@
176176

177177
if (keys.length > 1) {
178178
mods = getMods(keys);
179-
key = keys[keys.length - 1];
180179
}
181180

181+
key = keys[keys.length - 1];
182182
key = code(key);
183183

184184
if (scope === undefined) {

test/keymaster.html

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,23 @@ <h1>Keymaster unit tests</h1>
199199
t.assertEqual(1, cntCtrlShiftA);
200200
},
201201

202+
testUnbindWithKeysMultiple: function(t){
203+
var cntSlashF = 0;
204+
key('/, f', function(){ cntSlashF++ });
205+
206+
keydown(191); keyup(191);
207+
keydown(70); keyup(70);
208+
209+
t.assertEqual(2, cntSlashF);
210+
211+
key.unbind('/, f');
212+
213+
keydown(191); keyup(191);
214+
keydown(70); keyup(70);
215+
216+
t.assertEqual(2, cntSlashF);
217+
},
218+
202219
testFancyModifierKeys: function(t){
203220
var sequence = '';
204221
key('⌃+a', function(){ sequence += 'a' });

0 commit comments

Comments
 (0)