Skip to content

Commit

Permalink
Tests for mouseClick.
Browse files Browse the repository at this point in the history
  • Loading branch information
octalmage committed Jan 8, 2016
1 parent d8cbb74 commit b0cfad0
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions test/mouse.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,32 @@ test('Move the mouse smoothly.', function(t)
t.ok(robot.moveMouseSmooth("0", "0") === 1, 'move mouse to ("0", "0").');

});

test('Click the mouse.', function(t)
{
t.plan(8);
t.ok(robot.mouseClick(), 'click the mouse (no button specified).');
t.ok(robot.mouseClick("left") === 1, 'click the left mouse button.');
t.ok(robot.mouseClick("middle") === 1, 'click the middle mouse button.');
t.ok(robot.mouseClick("right") === 1, 'click the right mouse button.');

t.ok(robot.mouseClick("left", 1), 'double click the left mouse button.');

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

t.throws(function()
{
robot.mouseClick("0");
}, /Invalid mouse/, 'click an incorrect mouse button (0).');

t.throws(function()
{
robot.mouseClick("left", 0, "test");
}, /Invalid number/, 'click the mouse with an extra argument.');

});

test('Drag the mouse.', function(t)
Expand Down

0 comments on commit b0cfad0

Please sign in to comment.