From dfa83f6d84bee6f6a29663bb7a47e6130e86727c Mon Sep 17 00:00:00 2001 From: Jason Stallings Date: Fri, 8 Jan 2016 10:41:40 -0600 Subject: [PATCH] Tests for dragMouse. --- test/mouse.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/test/mouse.js b/test/mouse.js index c325e76c..70adf74a 100644 --- a/test/mouse.js +++ b/test/mouse.js @@ -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).'); + +});