Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added unit test

  • Loading branch information...
commit 3520847d03c1d587375a6f3d8cbf6885876ac6f4 1 parent 110b114
@mimshwright mimshwright authored
Showing with 18 additions and 0 deletions.
  1. +18 −0 test/keymaster.html
View
18 test/keymaster.html
@@ -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>
Please sign in to comment.
Something went wrong with that request. Please try again.