Skip to content

Commit

Permalink
Tests for dragMouse.
Browse files Browse the repository at this point in the history
  • Loading branch information
octalmage committed Jan 8, 2016
1 parent 93417d3 commit dfa83f6
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions test/mouse.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,26 @@ test('Move the mouse.', function(t)
t.ok(currentPos.x === 100, 'mousepos.x is correct.');
t.ok(currentPos.y === 100, 'mousepos.y is correct.');
});

test('Drag the mouse.', function(t)
{
t.plan(4);

t.ok(robot.dragMouse(5, 5) === 1, 'successfully dragged the mouse.');

t.throws(function()
{
robot.dragMouse(0);
}, /Invalid number/, 'drag mouse to (0).');

t.throws(function()
{
robot.dragMouse(1, 1, "left", 5);
}, /Invalid number/, 'drag mouse with extra argument.');

t.throws(function()
{
robot.dragMouse(2, 2, "party");
}, /Invalid mouse/, 'drag an incorrect mouse button (party).');

});

0 comments on commit dfa83f6

Please sign in to comment.