Skip to content

Commit b0cfad0

Browse files
committed
Tests for mouseClick.
1 parent d8cbb74 commit b0cfad0

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

test/mouse.js

+26
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,32 @@ test('Move the mouse smoothly.', function(t)
5858
t.ok(robot.moveMouseSmooth("0", "0") === 1, 'move mouse to ("0", "0").');
5959

6060
});
61+
62+
test('Click the mouse.', function(t)
63+
{
64+
t.plan(8);
65+
t.ok(robot.mouseClick(), 'click the mouse (no button specified).');
66+
t.ok(robot.mouseClick("left") === 1, 'click the left mouse button.');
67+
t.ok(robot.mouseClick("middle") === 1, 'click the middle mouse button.');
68+
t.ok(robot.mouseClick("right") === 1, 'click the right mouse button.');
69+
70+
t.ok(robot.mouseClick("left", 1), 'double click the left mouse button.');
71+
72+
t.throws(function()
73+
{
74+
robot.mouseClick("party");
75+
}, /Invalid mouse/, 'click an incorrect mouse button (party).');
76+
77+
t.throws(function()
78+
{
79+
robot.mouseClick("0");
80+
}, /Invalid mouse/, 'click an incorrect mouse button (0).');
81+
82+
t.throws(function()
83+
{
84+
robot.mouseClick("left", 0, "test");
85+
}, /Invalid number/, 'click the mouse with an extra argument.');
86+
6187
});
6288

6389
test('Drag the mouse.', function(t)

0 commit comments

Comments
 (0)