Skip to content

Commit

Permalink
making unbind work with multiple keys
Browse files Browse the repository at this point in the history
  • Loading branch information
burtonjc committed Jul 2, 2014
1 parent 0f09fc1 commit f198289
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion keymaster.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,9 @@

if (keys.length > 1) {
mods = getMods(keys);
key = keys[keys.length - 1];
}

key = keys[keys.length - 1];
key = code(key);

if (scope === undefined) {
Expand Down
17 changes: 17 additions & 0 deletions test/keymaster.html
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,23 @@ <h1>Keymaster unit tests</h1>
t.assertEqual(1, cntCtrlShiftA);
},

testUnbindWithKeysMultiple: function(t){
var cntSlashF = 0;
key('/, f', function(){ cntSlashF++ });

keydown(191); keyup(191);
keydown(70); keyup(70);

t.assertEqual(2, cntSlashF);

key.unbind('/, f');

keydown(191); keyup(191);
keydown(70); keyup(70);

t.assertEqual(2, cntSlashF);
},

testFancyModifierKeys: function(t){
var sequence = '';
key('⌃+a', function(){ sequence += 'a' });
Expand Down

0 comments on commit f198289

Please sign in to comment.