Fixed toHaveSize matcher on IE 10 & 11
This commit is contained in:
@@ -148,6 +148,24 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
||||
);
|
||||
};
|
||||
|
||||
j$.isWeakMap = function(obj) {
|
||||
return (
|
||||
obj !== null &&
|
||||
typeof obj !== 'undefined' &&
|
||||
typeof jasmineGlobal.WeakMap !== 'undefined' &&
|
||||
obj.constructor === jasmineGlobal.WeakMap
|
||||
);
|
||||
};
|
||||
|
||||
j$.isDataView = function(obj) {
|
||||
return (
|
||||
obj !== null &&
|
||||
typeof obj !== 'undefined' &&
|
||||
typeof jasmineGlobal.DataView !== 'undefined' &&
|
||||
obj.constructor === jasmineGlobal.DataView
|
||||
);
|
||||
};
|
||||
|
||||
j$.isPromise = function(obj) {
|
||||
return (
|
||||
typeof jasmineGlobal.Promise !== 'undefined' &&
|
||||
|
||||
@@ -16,11 +16,11 @@ getJasmineRequireObj().toHaveSize = function(j$) {
|
||||
pass: false
|
||||
};
|
||||
|
||||
if (j$.isA_('WeakSet', actual) || j$.isA_('WeakMap', actual) || j$.isA_('DataView', actual)) {
|
||||
if (j$.isA_('WeakSet', actual) || j$.isWeakMap(actual) || j$.isDataView(actual)) {
|
||||
throw new Error('Cannot get size of ' + actual + '.');
|
||||
}
|
||||
|
||||
if (actual instanceof Set || actual instanceof Map) {
|
||||
if (j$.isSet(actual) || j$.isMap(actual)) {
|
||||
result.pass = actual.size === expected;
|
||||
} else if (isLength(actual.length)) {
|
||||
result.pass = actual.length === expected;
|
||||
|
||||
Reference in New Issue
Block a user