Permalink
Browse files

Add test for scoping

  • Loading branch information...
agnoster committed Nov 3, 2011
1 parent 0a96e36 commit 78c62a3f4750485a83ba55ce056d8d8300540aca
Showing with 16 additions and 1 deletion.
  1. +16 −1 test/keymaster.html
View
@@ -155,7 +155,22 @@ <h1>Keymaster unit tests</h1>
},
testScoping: function(t){
- // TODO
+ var sequence = '';
+
+ key('a', function(){ sequence += 'a' });
+ key('b', function(){ sequence += 'b' });
+ key('b', 'capital', function(){ sequence += 'B' });
+
+ keydown(65); keyup(65);
+ key.setScope('capital');
+ keydown(66); keyup(66);
+ keydown(65); keyup(65);
+ key.setScope('unknown');
+ keydown(66); keyup(66);
+ key.setScope('all');
+ keydown(65); keyup(65);
+
+ t.assertEqual('abBaba', sequence);
},
testDoesntFireOnUserInputElements: function(t){

0 comments on commit 78c62a3

Please sign in to comment.