Permalink
Browse files

Merge pull request #70 from smdern/master

getPressedKeys() should return a clone of _downKeys
  • Loading branch information...
2 parents aaf3231 + f462707 commit 84df69f7b2edf1744038b02229bed445865509f9 @madrobby committed Dec 26, 2012
Showing with 3 additions and 1 deletion.
  1. +1 −1 keymaster.js
  2. +2 −0 test/keymaster.html
View
@@ -157,7 +157,7 @@
}
function getPressedKeyCodes() {
- return _downKeys;
+ return _downKeys.slice(0);
}
function filter(event){
View
@@ -244,8 +244,10 @@
testGetPressedKeyCodes: function (t) {
keydown(65); keydown(KEYS.shift);
var pressedKeys = key.getPressedKeyCodes();
+ var otherKeys = key.getPressedKeyCodes();
t.assertTrue(pressedKeys.indexOf(65) >= 0);
t.assertTrue(pressedKeys.indexOf(16) >= 0);
+ t.assertTrue(pressedKeys != otherKeys);
keyup(65); keyup(KEYS.shift);
},

0 comments on commit 84df69f

Please sign in to comment.