Skip to content

Commit c9063ca

Browse files
committed
Starting tests for keyTap.
1 parent 648fff4 commit c9063ca

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

test/keyboard.js

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
var test = require('tape');
2+
var robot = require('..');
3+
4+
//TODO: Need tests for keyToggle, typeString, typeStringDelayed, and setKeyboardDelay.
5+
6+
test('Tap a key.', function(t)
7+
{
8+
t.plan(4);
9+
t.ok(robot.keyTap("a") === 1, 'successfully tapped "a".');
10+
t.ok(robot.keyTap("a", "control") === 1, 'successfully tapped "ctrl+a".');
11+
12+
t.throws(function()
13+
{
14+
robot.keyTap();
15+
}, /Invalid number/, 'tap nothing.');
16+
17+
t.throws(function()
18+
{
19+
robot.keyTap();
20+
}, /Invalid number/, 'tap "ctrl+a" with an extra argument.');
21+
});

0 commit comments

Comments
 (0)