summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2022-10-13 08:35:30 +0200
committerPierre Ossman <ossman@cendio.se>2022-12-27 12:50:57 +0100
commit28c9670427ee987e14975fe75159e4bc5d7ee869 (patch)
treef573a2f2e2440b658ee8a9b753e3679a91441192
parent262a90b0e03da1ddf0b6ac5acd55a3167c4b558d (diff)
downloadnovnc-28c9670427ee987e14975fe75159e4bc5d7ee869.tar.gz
Remove test code for old Chrome
We don't care about ancient versions of Chrome anyway, so let's keep things simple.
-rw-r--r--tests/test.helper.js20
-rw-r--r--tests/test.keyboard.js49
-rw-r--r--tests/test.localization.js10
-rw-r--r--tests/test.webutil.js9
4 files changed, 9 insertions, 79 deletions
diff --git a/tests/test.helper.js b/tests/test.helper.js
index ed65770..ff83c53 100644
--- a/tests/test.helper.js
+++ b/tests/test.helper.js
@@ -71,18 +71,10 @@ describe('Helpers', function () {
origNavigator = Object.getOwnPropertyDescriptor(window, "navigator");
Object.defineProperty(window, "navigator", {value: {}});
- if (window.navigator.platform !== undefined) {
- // Object.defineProperty() doesn't work properly in old
- // versions of Chrome
- this.skip();
- }
-
window.navigator.platform = "Mac x86_64";
});
afterEach(function () {
- if (origNavigator !== undefined) {
- Object.defineProperty(window, "navigator", origNavigator);
- }
+ Object.defineProperty(window, "navigator", origNavigator);
});
it('should respect ContextMenu on modern browser', function () {
@@ -196,19 +188,11 @@ describe('Helpers', function () {
origNavigator = Object.getOwnPropertyDescriptor(window, "navigator");
Object.defineProperty(window, "navigator", {value: {}});
- if (window.navigator.platform !== undefined) {
- // Object.defineProperty() doesn't work properly in old
- // versions of Chrome
- this.skip();
- }
-
window.navigator.platform = "Windows";
});
afterEach(function () {
- if (origNavigator !== undefined) {
- Object.defineProperty(window, "navigator", origNavigator);
- }
+ Object.defineProperty(window, "navigator", origNavigator);
});
const keys = { 'Zenkaku': 0xff2a, 'Hankaku': 0xff2a,
diff --git a/tests/test.keyboard.js b/tests/test.keyboard.js
index 6b59cde..0d8cac6 100644
--- a/tests/test.keyboard.js
+++ b/tests/test.keyboard.js
@@ -144,18 +144,10 @@ describe('Key Event Handling', function () {
origNavigator = Object.getOwnPropertyDescriptor(window, "navigator");
Object.defineProperty(window, "navigator", {value: {}});
- if (window.navigator.platform !== undefined) {
- // Object.defineProperty() doesn't work properly in old
- // versions of Chrome
- this.skip();
- }
-
window.navigator.platform = "Mac x86_64";
});
afterEach(function () {
- if (origNavigator !== undefined) {
- Object.defineProperty(window, "navigator", origNavigator);
- }
+ Object.defineProperty(window, "navigator", origNavigator);
});
it('should change Alt to AltGraph', function () {
@@ -267,17 +259,10 @@ describe('Key Event Handling', function () {
origNavigator = Object.getOwnPropertyDescriptor(window, "navigator");
Object.defineProperty(window, "navigator", {value: {}});
- if (window.navigator.platform !== undefined) {
- // Object.defineProperty() doesn't work properly in old
- // versions of Chrome
- this.skip();
- }
});
afterEach(function () {
- if (origNavigator !== undefined) {
- Object.defineProperty(window, "navigator", origNavigator);
- }
+ Object.defineProperty(window, "navigator", origNavigator);
});
it('should toggle caps lock on key press on iOS', function () {
@@ -334,19 +319,11 @@ describe('Key Event Handling', function () {
origNavigator = Object.getOwnPropertyDescriptor(window, "navigator");
Object.defineProperty(window, "navigator", {value: {}});
- if (window.navigator.platform !== undefined) {
- // Object.defineProperty() doesn't work properly in old
- // versions of Chrome
- this.skip();
- }
-
window.navigator.platform = "Windows";
});
afterEach(function () {
- if (origNavigator !== undefined) {
- Object.defineProperty(window, "navigator", origNavigator);
- }
+ Object.defineProperty(window, "navigator", origNavigator);
});
const keys = { 'Zenkaku': 0xff2a, 'Hankaku': 0xff2a,
@@ -375,20 +352,12 @@ describe('Key Event Handling', function () {
origNavigator = Object.getOwnPropertyDescriptor(window, "navigator");
Object.defineProperty(window, "navigator", {value: {}});
- if (window.navigator.platform !== undefined) {
- // Object.defineProperty() doesn't work properly in old
- // versions of Chrome
- this.skip();
- }
-
window.navigator.platform = "Windows x86_64";
this.clock = sinon.useFakeTimers();
});
afterEach(function () {
- if (origNavigator !== undefined) {
- Object.defineProperty(window, "navigator", origNavigator);
- }
+ Object.defineProperty(window, "navigator", origNavigator);
if (this.clock !== undefined) {
this.clock.restore();
}
@@ -520,20 +489,12 @@ describe('Key Event Handling', function () {
origNavigator = Object.getOwnPropertyDescriptor(window, "navigator");
Object.defineProperty(window, "navigator", {value: {}});
- if (window.navigator.platform !== undefined) {
- // Object.defineProperty() doesn't work properly in old
- // versions of Chrome
- this.skip();
- }
-
window.navigator.platform = "Windows x86_64";
this.clock = sinon.useFakeTimers();
});
afterEach(function () {
- if (origNavigator !== undefined) {
- Object.defineProperty(window, "navigator", origNavigator);
- }
+ Object.defineProperty(window, "navigator", origNavigator);
if (this.clock !== undefined) {
this.clock.restore();
}
diff --git a/tests/test.localization.js b/tests/test.localization.js
index 311353a..7e8e6c1 100644
--- a/tests/test.localization.js
+++ b/tests/test.localization.js
@@ -13,18 +13,10 @@ describe('Localization', function () {
origNavigator = Object.getOwnPropertyDescriptor(window, "navigator");
Object.defineProperty(window, "navigator", {value: {}});
- if (window.navigator.languages !== undefined) {
- // Object.defineProperty() doesn't work properly in old
- // versions of Chrome
- this.skip();
- }
-
window.navigator.languages = [];
});
afterEach(function () {
- if (origNavigator !== undefined) {
- Object.defineProperty(window, "navigator", origNavigator);
- }
+ Object.defineProperty(window, "navigator", origNavigator);
});
it('should use English by default', function () {
diff --git a/tests/test.webutil.js b/tests/test.webutil.js
index 6681b3c..76aa763 100644
--- a/tests/test.webutil.js
+++ b/tests/test.webutil.js
@@ -66,11 +66,6 @@ describe('WebUtil', function () {
origLocalStorage = Object.getOwnPropertyDescriptor(window, "localStorage");
Object.defineProperty(window, "localStorage", {value: {}});
- if (window.localStorage.setItem !== undefined) {
- // Object.defineProperty() doesn't work properly in old
- // versions of Chrome
- this.skip();
- }
window.localStorage.setItem = sinon.stub();
window.localStorage.getItem = sinon.stub();
@@ -79,9 +74,7 @@ describe('WebUtil', function () {
return WebUtil.initSettings();
});
afterEach(function () {
- if (origLocalStorage !== undefined) {
- Object.defineProperty(window, "localStorage", origLocalStorage);
- }
+ Object.defineProperty(window, "localStorage", origLocalStorage);
});
describe('writeSetting', function () {