Remove test code for old Chrome

We don't care about ancient versions of Chrome anyway, so let's keep
things simple.
This commit is contained in:
Pierre Ossman 2022-10-13 08:35:30 +02:00
parent 262a90b0e0
commit 28c9670427
4 changed files with 9 additions and 79 deletions

View File

@ -71,18 +71,10 @@ describe('Helpers', function () {
origNavigator = Object.getOwnPropertyDescriptor(window, "navigator"); origNavigator = Object.getOwnPropertyDescriptor(window, "navigator");
Object.defineProperty(window, "navigator", {value: {}}); 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"; window.navigator.platform = "Mac x86_64";
}); });
afterEach(function () { afterEach(function () {
if (origNavigator !== undefined) { Object.defineProperty(window, "navigator", origNavigator);
Object.defineProperty(window, "navigator", origNavigator);
}
}); });
it('should respect ContextMenu on modern browser', function () { it('should respect ContextMenu on modern browser', function () {
@ -196,19 +188,11 @@ describe('Helpers', function () {
origNavigator = Object.getOwnPropertyDescriptor(window, "navigator"); origNavigator = Object.getOwnPropertyDescriptor(window, "navigator");
Object.defineProperty(window, "navigator", {value: {}}); 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"; window.navigator.platform = "Windows";
}); });
afterEach(function () { afterEach(function () {
if (origNavigator !== undefined) { Object.defineProperty(window, "navigator", origNavigator);
Object.defineProperty(window, "navigator", origNavigator);
}
}); });
const keys = { 'Zenkaku': 0xff2a, 'Hankaku': 0xff2a, const keys = { 'Zenkaku': 0xff2a, 'Hankaku': 0xff2a,

View File

@ -144,18 +144,10 @@ describe('Key Event Handling', function () {
origNavigator = Object.getOwnPropertyDescriptor(window, "navigator"); origNavigator = Object.getOwnPropertyDescriptor(window, "navigator");
Object.defineProperty(window, "navigator", {value: {}}); 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"; window.navigator.platform = "Mac x86_64";
}); });
afterEach(function () { afterEach(function () {
if (origNavigator !== undefined) { Object.defineProperty(window, "navigator", origNavigator);
Object.defineProperty(window, "navigator", origNavigator);
}
}); });
it('should change Alt to AltGraph', function () { it('should change Alt to AltGraph', function () {
@ -267,17 +259,10 @@ describe('Key Event Handling', function () {
origNavigator = Object.getOwnPropertyDescriptor(window, "navigator"); origNavigator = Object.getOwnPropertyDescriptor(window, "navigator");
Object.defineProperty(window, "navigator", {value: {}}); 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 () { 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 () { 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"); origNavigator = Object.getOwnPropertyDescriptor(window, "navigator");
Object.defineProperty(window, "navigator", {value: {}}); 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"; window.navigator.platform = "Windows";
}); });
afterEach(function () { afterEach(function () {
if (origNavigator !== undefined) { Object.defineProperty(window, "navigator", origNavigator);
Object.defineProperty(window, "navigator", origNavigator);
}
}); });
const keys = { 'Zenkaku': 0xff2a, 'Hankaku': 0xff2a, const keys = { 'Zenkaku': 0xff2a, 'Hankaku': 0xff2a,
@ -375,20 +352,12 @@ describe('Key Event Handling', function () {
origNavigator = Object.getOwnPropertyDescriptor(window, "navigator"); origNavigator = Object.getOwnPropertyDescriptor(window, "navigator");
Object.defineProperty(window, "navigator", {value: {}}); 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"; window.navigator.platform = "Windows x86_64";
this.clock = sinon.useFakeTimers(); this.clock = sinon.useFakeTimers();
}); });
afterEach(function () { afterEach(function () {
if (origNavigator !== undefined) { Object.defineProperty(window, "navigator", origNavigator);
Object.defineProperty(window, "navigator", origNavigator);
}
if (this.clock !== undefined) { if (this.clock !== undefined) {
this.clock.restore(); this.clock.restore();
} }
@ -520,20 +489,12 @@ describe('Key Event Handling', function () {
origNavigator = Object.getOwnPropertyDescriptor(window, "navigator"); origNavigator = Object.getOwnPropertyDescriptor(window, "navigator");
Object.defineProperty(window, "navigator", {value: {}}); 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"; window.navigator.platform = "Windows x86_64";
this.clock = sinon.useFakeTimers(); this.clock = sinon.useFakeTimers();
}); });
afterEach(function () { afterEach(function () {
if (origNavigator !== undefined) { Object.defineProperty(window, "navigator", origNavigator);
Object.defineProperty(window, "navigator", origNavigator);
}
if (this.clock !== undefined) { if (this.clock !== undefined) {
this.clock.restore(); this.clock.restore();
} }

View File

@ -13,18 +13,10 @@ describe('Localization', function () {
origNavigator = Object.getOwnPropertyDescriptor(window, "navigator"); origNavigator = Object.getOwnPropertyDescriptor(window, "navigator");
Object.defineProperty(window, "navigator", {value: {}}); 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 = []; window.navigator.languages = [];
}); });
afterEach(function () { afterEach(function () {
if (origNavigator !== undefined) { Object.defineProperty(window, "navigator", origNavigator);
Object.defineProperty(window, "navigator", origNavigator);
}
}); });
it('should use English by default', function () { it('should use English by default', function () {

View File

@ -66,11 +66,6 @@ describe('WebUtil', function () {
origLocalStorage = Object.getOwnPropertyDescriptor(window, "localStorage"); origLocalStorage = Object.getOwnPropertyDescriptor(window, "localStorage");
Object.defineProperty(window, "localStorage", {value: {}}); 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.setItem = sinon.stub();
window.localStorage.getItem = sinon.stub(); window.localStorage.getItem = sinon.stub();
@ -79,9 +74,7 @@ describe('WebUtil', function () {
return WebUtil.initSettings(); return WebUtil.initSettings();
}); });
afterEach(function () { afterEach(function () {
if (origLocalStorage !== undefined) { Object.defineProperty(window, "localStorage", origLocalStorage);
Object.defineProperty(window, "localStorage", origLocalStorage);
}
}); });
describe('writeSetting', function () { describe('writeSetting', function () {