mirror of
https://github.com/localForage/localForage.git
synced 2026-01-25 14:44:26 +00:00
Fix runner to work in IE8
This commit is contained in:
parent
eb4c5e74b8
commit
ebaf25bdfd
@ -1,11 +1,9 @@
|
||||
// Run before window.onload to make sure the specs have access to describe()
|
||||
// and other mocha methods. All feels very hacky though :-/
|
||||
var mocha = this.mocha;
|
||||
|
||||
mocha.setup('bdd');
|
||||
this.mocha.setup('bdd');
|
||||
|
||||
function runTests() {
|
||||
var runner = mocha.run();
|
||||
var runner = this.mocha.run();
|
||||
|
||||
var failedTests = [];
|
||||
|
||||
@ -38,6 +36,18 @@ function runTests() {
|
||||
runner.on('fail', logFailure);
|
||||
}
|
||||
|
||||
if (!Array.prototype.forEach) {
|
||||
Array.prototype.forEach = function(callback, thisArg) {
|
||||
if (typeof(callback) !== "function") {
|
||||
throw new TypeError(callback + " is not a function!");
|
||||
}
|
||||
var len = this.length;
|
||||
for (var i = 0; i < len; i++) {
|
||||
callback.call(thisArg, this[i], i, this)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var require = this.require;
|
||||
if (require) {
|
||||
requirejs.config({
|
||||
@ -57,6 +67,8 @@ if (require) {
|
||||
'/test/test.webworkers.js'
|
||||
], runTests);
|
||||
});
|
||||
} else {
|
||||
} else if (this.addEventListener) {
|
||||
this.addEventListener('load', runTests);
|
||||
} else if (this.attachEvent) {
|
||||
this.attachEvent('onload', runTests);
|
||||
}
|
||||
|
||||
@ -1,7 +1,5 @@
|
||||
/* global beforeEach:true */
|
||||
var mocha = this.mocha;
|
||||
|
||||
mocha.setup('bdd');
|
||||
this.mocha.setup('bdd');
|
||||
|
||||
beforeEach(function(done) {
|
||||
var previousDriver = localforage.driver();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user