Files
openlayers/test/test-extensions.js
2013-03-13 04:32:43 +01:00

25 lines
424 B
JavaScript

function waitsFor(condition, message, timeout, callback) {
var timeWaiting = 0;
function inner() {
if (condition()) {
callback();
return;
}
if (timeWaiting >= timeout) {
throw new Error(message);
}
timeWaiting += 10;
setTimeout(inner, 10);
}
inner();
}
expect.Assertion.prototype.roughlyEqual = function(other, tol) {
return Math.abs(this.actual - other) <= tol;
};