Make afterEach() hooks work when skipping tests
Mocha will now run afterEach() hooks when tests are skipped, so we need to make them more robust against things being partially set up.
This commit is contained in:
parent
8394462356
commit
eb05b45b70
|
@ -86,7 +86,9 @@ describe('Helpers', function () {
|
|||
window.navigator.platform = "Mac x86_64";
|
||||
});
|
||||
afterEach(function () {
|
||||
Object.defineProperty(window, "navigator", origNavigator);
|
||||
if (origNavigator !== undefined) {
|
||||
Object.defineProperty(window, "navigator", origNavigator);
|
||||
}
|
||||
});
|
||||
|
||||
it('should respect ContextMenu on modern browser', function () {
|
||||
|
@ -150,7 +152,9 @@ describe('Helpers', function () {
|
|||
}
|
||||
});
|
||||
afterEach(function () {
|
||||
Object.defineProperty(window, "navigator", origNavigator);
|
||||
if (origNavigator !== undefined) {
|
||||
Object.defineProperty(window, "navigator", origNavigator);
|
||||
}
|
||||
});
|
||||
|
||||
it('should ignore printable character key on IE', function () {
|
||||
|
|
|
@ -272,7 +272,9 @@ describe('Key Event Handling', function () {
|
|||
window.navigator.platform = "Mac x86_64";
|
||||
});
|
||||
afterEach(function () {
|
||||
Object.defineProperty(window, "navigator", origNavigator);
|
||||
if (origNavigator !== undefined) {
|
||||
Object.defineProperty(window, "navigator", origNavigator);
|
||||
}
|
||||
});
|
||||
|
||||
it('should change Alt to AltGraph', function () {
|
||||
|
@ -336,7 +338,9 @@ describe('Key Event Handling', function () {
|
|||
});
|
||||
|
||||
afterEach(function () {
|
||||
Object.defineProperty(window, "navigator", origNavigator);
|
||||
if (origNavigator !== undefined) {
|
||||
Object.defineProperty(window, "navigator", origNavigator);
|
||||
}
|
||||
});
|
||||
|
||||
it('should toggle caps lock on key press on iOS', function (done) {
|
||||
|
@ -413,8 +417,12 @@ describe('Key Event Handling', function () {
|
|||
this.clock = sinon.useFakeTimers();
|
||||
});
|
||||
afterEach(function () {
|
||||
Object.defineProperty(window, "navigator", origNavigator);
|
||||
this.clock.restore();
|
||||
if (origNavigator !== undefined) {
|
||||
Object.defineProperty(window, "navigator", origNavigator);
|
||||
}
|
||||
if (this.clock !== undefined) {
|
||||
this.clock.restore();
|
||||
}
|
||||
});
|
||||
|
||||
it('should supress ControlLeft until it knows if it is AltGr', function () {
|
||||
|
@ -559,8 +567,12 @@ describe('Key Event Handling', function () {
|
|||
this.clock = sinon.useFakeTimers();
|
||||
});
|
||||
afterEach(function () {
|
||||
Object.defineProperty(window, "navigator", origNavigator);
|
||||
this.clock.restore();
|
||||
if (origNavigator !== undefined) {
|
||||
Object.defineProperty(window, "navigator", origNavigator);
|
||||
}
|
||||
if (this.clock !== undefined) {
|
||||
this.clock.restore();
|
||||
}
|
||||
});
|
||||
|
||||
it('should fake a left Shift keyup', function () {
|
||||
|
|
|
@ -27,7 +27,9 @@ describe('Localization', function () {
|
|||
window.navigator.languages = [];
|
||||
});
|
||||
afterEach(function () {
|
||||
Object.defineProperty(window, "navigator", origNavigator);
|
||||
if (origNavigator !== undefined) {
|
||||
Object.defineProperty(window, "navigator", origNavigator);
|
||||
}
|
||||
});
|
||||
|
||||
it('should use English by default', function () {
|
||||
|
|
|
@ -42,7 +42,9 @@ describe('WebUtil', function () {
|
|||
return WebUtil.initSettings();
|
||||
});
|
||||
afterEach(function () {
|
||||
Object.defineProperty(window, "localStorage", origLocalStorage);
|
||||
if (origLocalStorage !== undefined) {
|
||||
Object.defineProperty(window, "localStorage", origLocalStorage);
|
||||
}
|
||||
});
|
||||
|
||||
describe('writeSetting', function () {
|
||||
|
|
Loading…
Reference in New Issue