]> git.proxmox.com Git - mirror_novnc.git/blobdiff - tests/test.helper.js
Move localization.js to app
[mirror_novnc.git] / tests / test.helper.js
index e0ae80ac0a29f25164837ca85d49542529ddc971..aa64e9550edc3f6c3c8694fa36d5be0ca837c4ae 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() {
@@ -107,6 +115,7 @@ describe('Helpers', function() {
             expect(KeyboardUtil.getKey({key: 'Left'})).to.be.equal('ArrowLeft');
             expect(KeyboardUtil.getKey({key: 'OS'})).to.be.equal('Meta');
             expect(KeyboardUtil.getKey({key: 'Win'})).to.be.equal('Meta');
+            expect(KeyboardUtil.getKey({key: 'UIKeyInputLeftArrow'})).to.be.equal('ArrowLeft');
         });
         it('should use code if no key', function() {
             expect(KeyboardUtil.getKey({code: 'NumpadBackspace'})).to.be.equal('Backspace');
@@ -201,6 +210,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 +221,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);
             });