Example #1
0
 it('should handle multiple modifiers', () => {
   let event = generate('keydown', {
     ctrlKey: true,
     altKey: true,
     shiftKey: true,
     keyCode: 83
   });
   let keystroke = CommandRegistry.keystrokeForKeydownEvent(event as KeyboardEvent);
   expect(keystroke).to.equal('Ctrl Alt Shift S');
 });
Example #2
0
 it('should fail on an invalid shortcut', () => {
   let event = generate('keydown', { keyCode: -1 });
   let keystroke = CommandRegistry.keystrokeForKeydownEvent(event as KeyboardEvent);
   expect(keystroke).to.equal('');
 });
Example #3
0
 it('should create a normalized keystroke', () => {
   let event = generate('keydown', { ctrlKey: true, keyCode: 83 });
   let keystroke = CommandRegistry.keystrokeForKeydownEvent(event as KeyboardEvent);
   expect(keystroke).to.equal('Ctrl S');
 });