Skip to content

Commit

Permalink
Merge pull request #129 from burtonjc/master
Browse files Browse the repository at this point in the history
making unbind work with multiple keys
  • Loading branch information
madrobby committed Jul 2, 2014
2 parents 0f09fc1 + f198289 commit 564ea42
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 564ea42

Please sign in to comment.