Removed support for Internet Explorer
This commit is contained in:
@@ -75,15 +75,8 @@ getJasmineRequireObj().Expectation = function(j$) {
|
||||
* @namespace async-matchers
|
||||
*/
|
||||
function AsyncExpectation(options) {
|
||||
var global = options.global || j$.getGlobal();
|
||||
this.expector = new j$.Expector(options);
|
||||
|
||||
if (!global.Promise) {
|
||||
throw new Error(
|
||||
'expectAsync is unavailable because the environment does not support promises.'
|
||||
);
|
||||
}
|
||||
|
||||
var customAsyncMatchers = options.customAsyncMatchers || {};
|
||||
for (var matcherName in customAsyncMatchers) {
|
||||
this[matcherName] = wrapAsyncCompare(
|
||||
|
||||
@@ -87,11 +87,7 @@ getJasmineRequireObj().MockDate = function() {
|
||||
FakeDate.prototype = GlobalDate.prototype;
|
||||
|
||||
FakeDate.now = function() {
|
||||
if (GlobalDate.now) {
|
||||
return currentTime;
|
||||
} else {
|
||||
throw new Error('Browser does not support Date.now()');
|
||||
}
|
||||
return currentTime;
|
||||
};
|
||||
|
||||
FakeDate.toSource = GlobalDate.toSource;
|
||||
|
||||
@@ -17,7 +17,7 @@ getJasmineRequireObj().StackTrace = function(j$) {
|
||||
}
|
||||
|
||||
var framePatterns = [
|
||||
// PhantomJS on Linux, Node, Chrome, IE, Edge
|
||||
// Node, Chrome, Edge
|
||||
// e.g. " at QueueRunner.run (http://localhost:8888/__jasmine__/jasmine.js:4320:20)"
|
||||
// Note that the "function name" can include a surprisingly large set of
|
||||
// characters, including angle brackets and square brackets.
|
||||
|
||||
@@ -13,27 +13,26 @@ getJasmineRequireObj().MapContaining = function(j$) {
|
||||
MapContaining.prototype.asymmetricMatch = function(other, matchersUtil) {
|
||||
if (!j$.isMap(other)) return false;
|
||||
|
||||
var hasAllMatches = true;
|
||||
j$.util.forEachBreakable(this.sample, function(breakLoop, value, key) {
|
||||
for (const [key, value] of this.sample) {
|
||||
// for each key/value pair in `sample`
|
||||
// there should be at least one pair in `other` whose key and value both match
|
||||
var hasMatch = false;
|
||||
j$.util.forEachBreakable(other, function(oBreakLoop, oValue, oKey) {
|
||||
for (const [oKey, oValue] of other) {
|
||||
if (
|
||||
matchersUtil.equals(oKey, key) &&
|
||||
matchersUtil.equals(oValue, value)
|
||||
) {
|
||||
hasMatch = true;
|
||||
oBreakLoop();
|
||||
break;
|
||||
}
|
||||
});
|
||||
if (!hasMatch) {
|
||||
hasAllMatches = false;
|
||||
breakLoop();
|
||||
}
|
||||
});
|
||||
|
||||
return hasAllMatches;
|
||||
if (!hasMatch) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
MapContaining.prototype.jasmineToString = function(pp) {
|
||||
|
||||
@@ -13,25 +13,24 @@ getJasmineRequireObj().SetContaining = function(j$) {
|
||||
SetContaining.prototype.asymmetricMatch = function(other, matchersUtil) {
|
||||
if (!j$.isSet(other)) return false;
|
||||
|
||||
var hasAllMatches = true;
|
||||
j$.util.forEachBreakable(this.sample, function(breakLoop, item) {
|
||||
for (const item of this.sample) {
|
||||
// for each item in `sample` there should be at least one matching item in `other`
|
||||
// (not using `matchersUtil.contains` because it compares set members by reference,
|
||||
// not by deep value equality)
|
||||
var hasMatch = false;
|
||||
j$.util.forEachBreakable(other, function(oBreakLoop, oItem) {
|
||||
for (const oItem of other) {
|
||||
if (matchersUtil.equals(oItem, item)) {
|
||||
hasMatch = true;
|
||||
oBreakLoop();
|
||||
break;
|
||||
}
|
||||
});
|
||||
if (!hasMatch) {
|
||||
hasAllMatches = false;
|
||||
breakLoop();
|
||||
}
|
||||
});
|
||||
|
||||
return hasAllMatches;
|
||||
if (!hasMatch) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
SetContaining.prototype.jasmineToString = function(pp) {
|
||||
|
||||
@@ -106,25 +106,8 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
if (value instanceof Error) {
|
||||
return true;
|
||||
}
|
||||
if (
|
||||
typeof window !== 'undefined' &&
|
||||
typeof window.trustedTypes !== 'undefined'
|
||||
) {
|
||||
return (
|
||||
typeof value.stack === 'string' && typeof value.message === 'string'
|
||||
);
|
||||
}
|
||||
if (value && value.constructor && value.constructor.constructor) {
|
||||
var valueGlobal = value.constructor.constructor('return this');
|
||||
if (j$.isFunction_(valueGlobal)) {
|
||||
valueGlobal = valueGlobal();
|
||||
}
|
||||
|
||||
if (valueGlobal.Error && value instanceof valueGlobal.Error) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return typeof value.stack === 'string' && typeof value.message === 'string';
|
||||
};
|
||||
|
||||
j$.isAsymmetricEqualityTester_ = function(obj) {
|
||||
@@ -166,7 +149,6 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
return (
|
||||
obj !== null &&
|
||||
typeof obj !== 'undefined' &&
|
||||
typeof jasmineGlobal.WeakMap !== 'undefined' &&
|
||||
obj.constructor === jasmineGlobal.WeakMap
|
||||
);
|
||||
};
|
||||
@@ -175,7 +157,6 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
return (
|
||||
obj !== null &&
|
||||
typeof obj !== 'undefined' &&
|
||||
typeof jasmineGlobal.URL !== 'undefined' &&
|
||||
obj.constructor === jasmineGlobal.URL
|
||||
);
|
||||
};
|
||||
@@ -184,17 +165,12 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
return (
|
||||
obj !== null &&
|
||||
typeof obj !== 'undefined' &&
|
||||
typeof jasmineGlobal.DataView !== 'undefined' &&
|
||||
obj.constructor === jasmineGlobal.DataView
|
||||
);
|
||||
};
|
||||
|
||||
j$.isPromise = function(obj) {
|
||||
return (
|
||||
typeof jasmineGlobal.Promise !== 'undefined' &&
|
||||
!!obj &&
|
||||
obj.constructor === jasmineGlobal.Promise
|
||||
);
|
||||
return !!obj && obj.constructor === jasmineGlobal.Promise;
|
||||
};
|
||||
|
||||
j$.isPromiseLike = function(obj) {
|
||||
@@ -215,7 +191,6 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
|
||||
j$.isPending_ = function(promise) {
|
||||
var sentinel = {};
|
||||
// eslint-disable-next-line compat/compat
|
||||
return Promise.race([promise, Promise.resolve(sentinel)]).then(
|
||||
function(result) {
|
||||
return result === sentinel;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable compat/compat */
|
||||
getJasmineRequireObj().toBePending = function(j$) {
|
||||
/**
|
||||
* Expect a promise to be pending, i.e. the promise is neither resolved nor rejected.
|
||||
|
||||
@@ -37,7 +37,7 @@ getJasmineRequireObj().toHaveSize = function(j$) {
|
||||
};
|
||||
}
|
||||
|
||||
var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991; // eslint-disable-line compat/compat
|
||||
var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991;
|
||||
function isLength(value) {
|
||||
return (
|
||||
typeof value == 'number' &&
|
||||
|
||||
@@ -127,20 +127,5 @@ getJasmineRequireObj().util = function(j$) {
|
||||
StopIteration.prototype = Object.create(Error.prototype);
|
||||
StopIteration.prototype.constructor = StopIteration;
|
||||
|
||||
// useful for maps and sets since `forEach` is the only IE11-compatible way to iterate them
|
||||
util.forEachBreakable = function(iterable, iteratee) {
|
||||
function breakLoop() {
|
||||
throw new StopIteration();
|
||||
}
|
||||
|
||||
try {
|
||||
iterable.forEach(function(value, key) {
|
||||
iteratee(breakLoop, value, key, iterable);
|
||||
});
|
||||
} catch (error) {
|
||||
if (!(error instanceof StopIteration)) throw error;
|
||||
}
|
||||
};
|
||||
|
||||
return util;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user