diff --git a/test/keyboard.js b/test/keyboard.js index 11321272..ec576648 100644 --- a/test/keyboard.js +++ b/test/keyboard.js @@ -3,19 +3,32 @@ var robot = require('..'); //TODO: Need tests for keyToggle, typeString, typeStringDelayed, and setKeyboardDelay. -test('Tap a key.', function(t) +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.'); +}); + +// This test won't fail if there's an issue, but it will help you identify an issue if ran locally. +test('Tap all keys', function(t) +{ + var chars = 'abcdefghijklmnopqrstuvwxyz1234567890,./;\'[]\\'.split(''); + + for (var x in chars) + { + t.ok(robot.keyTap(chars[x]), 'tap ' + chars[x] + '.'); + } + + t.end(); }); \ No newline at end of file