]> git.proxmox.com Git - mirror_novnc.git/commitdiff
Skip some keyboard tests on IE and Edge
authorPierre Ossman <ossman@cendio.se>
Thu, 4 May 2017 11:26:39 +0000 (13:26 +0200)
committerPierre Ossman <ossman@cendio.se>
Thu, 4 May 2017 11:26:39 +0000 (13:26 +0200)
IE and Edge has some broken behaviour for keyboard events that
prevent the standard tests from running properly.

tests/test.helper.js
tests/test.keyboard.js

index e0ae80ac0a29f25164837ca85d49542529ddc971..e3bf8ac1b0862c28078fee199ead686385e0b5ea 100644 (file)
@@ -4,6 +4,13 @@ var expect = chai.expect;
 import keysyms from '../core/input/keysymdef.js';
 import * as KeyboardUtil from "../core/input/util.js";
 
+function isIE() {
+    return navigator && !!(/trident/i).exec(navigator.userAgent);
+}
+function isEdge() {
+    return navigator && !!(/edge/i).exec(navigator.userAgent);
+}
+
 describe('Helpers', function() {
     "use strict";
 
@@ -100,6 +107,7 @@ describe('Helpers', function() {
 
     describe('getKey', function() {
         it('should prefer key', function() {
+            if (isIE() || isEdge()) this.skip();
             expect(KeyboardUtil.getKey({key: 'a', charCode: 'Š'.charCodeAt(), keyCode: 0x42, which: 0x43})).to.be.equal('a');
         });
         it('should map legacy values', function() {
@@ -201,6 +209,7 @@ describe('Helpers', function() {
 
         describe('Numpad', function() {
             it('should handle Numpad numbers', function() {
+                if (isIE() || isEdge()) this.skip();
                 expect(KeyboardUtil.getKeysym({code: 'Digit5', key: '5', location: 0})).to.be.equal(0x0035);
                 expect(KeyboardUtil.getKeysym({code: 'Numpad5', key: '5', location: 3})).to.be.equal(0xFFB5);
             });
@@ -211,6 +220,7 @@ describe('Helpers', function() {
                 expect(KeyboardUtil.getKeysym({code: 'NumpadDecimal', key: 'Delete', location: 3})).to.be.equal(0xFF9F);
             });
             it('should handle Numpad Decimal key', function() {
+                if (isIE() || isEdge()) this.skip();
                 expect(KeyboardUtil.getKeysym({code: 'NumpadDecimal', key: '.', location: 3})).to.be.equal(0xFFAE);
                 expect(KeyboardUtil.getKeysym({code: 'NumpadDecimal', key: ',', location: 3})).to.be.equal(0xFFAC);
             });
index a4ac63042c6d9283a1139998b3a9761ca802aac4..332d88c402cf942862ce20136a73b9fd638fa35f 100644 (file)
@@ -5,6 +5,13 @@ import { Keyboard } from '../core/input/devices.js';
 import keysyms from '../core/input/keysymdef.js';
 import * as KeyboardUtil from '../core/input/util.js';
 
+function isIE() {
+    return navigator && !!(/trident/i).exec(navigator.userAgent);
+}
+function isEdge() {
+    return navigator && !!(/edge/i).exec(navigator.userAgent);
+}
+
 /* jshint newcap: false, expr: true */
 describe('Key Event Handling', function() {
     "use strict";
@@ -23,6 +30,7 @@ describe('Key Event Handling', function() {
 
     describe('Decode Keyboard Events', function() {
         it('should decode keydown events', function(done) {
+            if (isIE() || isEdge()) this.skip();
             var kbd = new Keyboard({
             onKeyEvent: function(keysym, code, down) {
                 expect(keysym).to.be.equal(0x61);
@@ -33,6 +41,7 @@ describe('Key Event Handling', function() {
             kbd._handleKeyDown(keyevent('keydown', {code: 'KeyA', key: 'a'}));
         });
         it('should decode keyup events', function(done) {
+            if (isIE() || isEdge()) this.skip();
             var calls = 0;
             var kbd = new Keyboard({
             onKeyEvent: function(keysym, code, down) {
@@ -86,6 +95,9 @@ describe('Key Event Handling', function() {
         });
 
         describe('suppress the right events at the right time', function() {
+            beforeEach(function () {
+                if (isIE() || isEdge()) this.skip();
+            });
             it('should suppress anything with a valid key', function() {
                 var kbd = new Keyboard({});
                 var evt = keyevent('keydown', {code: 'KeyA', key: 'a'});
@@ -113,6 +125,9 @@ describe('Key Event Handling', function() {
     });
 
     describe('Track Key State', function() {
+        beforeEach(function () {
+            if (isIE() || isEdge()) this.skip();
+        });
         it('should send release using the same keysym as the press', function(done) {
             var kbd = new Keyboard({
             onKeyEvent: function(keysym, code, down) {