From 6ec3af22ca952c5e7a5240da39d178fd995dfd5a Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Tue, 29 Nov 2016 16:06:20 +0100 Subject: [PATCH] Skip language tests on broken browsers The hacks needed to run these tests require proper handling of properties. Unfortunately IE and old versions of Chrome mess up, so just skip the tests there. --- tests/test.util.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/test.util.js b/tests/test.util.js index bce475da..60cdb582 100644 --- a/tests/test.util.js +++ b/tests/test.util.js @@ -63,7 +63,19 @@ describe('Utils', function() { // environments, so we need to redefine it whilst running these // tests. origNavigator = Object.getOwnPropertyDescriptor(window, "navigator"); + if (origNavigator === undefined) { + // Object.getOwnPropertyDescriptor() doesn't work + // properly in any version of IE + this.skip(); + } + 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 () {