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.
This commit is contained in:
Pierre Ossman 2016-11-29 16:06:20 +01:00
parent acca6487f2
commit 6ec3af22ca
1 changed files with 12 additions and 0 deletions

View File

@ -63,7 +63,19 @@ describe('Utils', function() {
// environments, so we need to redefine it whilst running these // environments, so we need to redefine it whilst running these
// tests. // tests.
origNavigator = Object.getOwnPropertyDescriptor(window, "navigator"); 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: {}}); 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 () {