diff --git a/tests/test.keyboard.js b/tests/test.keyboard.js index 135c5981b..11c8b6eb7 100644 --- a/tests/test.keyboard.js +++ b/tests/test.keyboard.js @@ -478,6 +478,22 @@ describe('Key Event Handling', function () { expect(kbd.onkeyevent).to.not.have.been.called; }); + it('should release ControlLeft on blur', function () { + const kbd = new Keyboard(document); + kbd.onkeyevent = sinon.spy(); + kbd._handleKeyDown(keyevent('keydown', {code: 'ControlLeft', key: 'Control', location: 1})); + expect(kbd.onkeyevent).to.not.have.been.called; + kbd._allKeysUp(); + expect(kbd.onkeyevent).to.have.been.calledTwice; + expect(kbd.onkeyevent.firstCall).to.have.been.calledWith(0xffe3, "ControlLeft", true); + expect(kbd.onkeyevent.secondCall).to.have.been.calledWith(0xffe3, "ControlLeft", false); + + // Check that the timer is properly dead + kbd.onkeyevent.resetHistory(); + this.clock.tick(100); + expect(kbd.onkeyevent).to.not.have.been.called; + }); + it('should generate AltGraph for quick Ctrl+Alt sequence', function () { const kbd = new Keyboard(document); kbd.onkeyevent = sinon.spy();