Skip to content

Commit

Permalink
Starting tests for keyTap.
Browse files Browse the repository at this point in the history
  • Loading branch information
octalmage committed Jan 8, 2016
1 parent 648fff4 commit c9063ca
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions test/keyboard.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
var test = require('tape');
var robot = require('..');

//TODO: Need tests for keyToggle, typeString, typeStringDelayed, and setKeyboardDelay.

test('Tap a key.', function(t)
{
t.plan(4);
t.ok(robot.keyTap("a") === 1, 'successfully tapped "a".');
t.ok(robot.keyTap("a", "control") === 1, 'successfully tapped "ctrl+a".');

t.throws(function()
{
robot.keyTap();
}, /Invalid number/, 'tap nothing.');

t.throws(function()
{
robot.keyTap();
}, /Invalid number/, 'tap "ctrl+a" with an extra argument.');
});

0 comments on commit c9063ca

Please sign in to comment.