Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add test for multiple assigned shortcuts

  • Loading branch information...
commit 155e5c22e6642babf67fc0df956f5dc4927256e7 1 parent 2d921f2
@brainss authored
Showing with 17 additions and 0 deletions.
  1. +17 −0 test/multipleAssignment.js
View
17 test/multipleAssignment.js
@@ -0,0 +1,17 @@
+var shortcut = require('../shortcut')(process.stdin)
+ , test = require('tap').test
+ , stdin = process.stdin
+
+test('Only execute matched handlers', function(t) {
+ shortcut('ctrl+a, alt+a', function(char, key) {
+ t.ok(true)
+ })
+ stdin.emit('keypress', 'a', key('a', true))
+ t.plan(1)
+})
+
+// keypress simulator
+function key(name, ctrl, shift, meta) {
+ ctrl = ctrl || false; shift = shift || false; meta = meta || false
+ return {name: name, ctrl: ctrl, shift: shift, meta: meta}
+}
Please sign in to comment.
Something went wrong with that request. Please try again.