Permalink
Browse files

Added unit test

  • Loading branch information...
1 parent 110b114 commit 3520847d03c1d587375a6f3d8cbf6885876ac6f4 @mimshwright mimshwright committed Nov 6, 2012
Showing with 18 additions and 0 deletions.
  1. +18 −0 test/keymaster.html
View
@@ -229,6 +229,24 @@
t.assertEqual(1, filterCalls);
t.assertEqual(1, keyCalls);
+ },
+
+ testIsPressed: function (t) {
+ keydown(65);
+ t.assertTrue(key.isPressed(65));
+ t.assertTrue(key.isPressed("a"));
+ keyup(65);
+
+ keydown(66); keyup(66);
+ t.assertFalse(key.isPressed(66));
+ },
+
+ testGetPressedKeyCodes: function (t) {
+ keydown(65); keydown(KEYS.shift);
+ var pressedKeys = key.getPressedKeyCodes();
+ t.assertTrue(pressedKeys.indexOf(65) >= 0);
+ t.assertTrue(pressedKeys.indexOf(16) >= 0);
+ keyup(65); keyup(KEYS.shift);
}
});
</script>

0 comments on commit 3520847

Please sign in to comment.