From 28c9670427ee987e14975fe75159e4bc5d7ee869 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Thu, 13 Oct 2022 08:35:30 +0200 Subject: Remove test code for old Chrome We don't care about ancient versions of Chrome anyway, so let's keep things simple. --- tests/test.helper.js | 20 ++----------------- tests/test.keyboard.js | 49 +++++----------------------------------------- tests/test.localization.js | 10 +--------- tests/test.webutil.js | 9 +-------- 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 () { -- cgit v1.2.1