Permalink
Browse files

Make sure getPressedKeys() returns new Array

  • Loading branch information...
1 parent aaf3231 commit f462707a8db1db01d4fee283a4809a8481755812 @smdern smdern committed Dec 25, 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 @@ <h1>Keymaster unit tests</h1>
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 f462707

Please sign in to comment.