Merge branch 'main' into 3.99
This commit is contained in:
@@ -294,9 +294,21 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
j$.isError_ = function(value) {
|
j$.isError_ = function(value) {
|
||||||
|
if (!value) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (value instanceof Error) {
|
if (value instanceof Error) {
|
||||||
return true;
|
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) {
|
if (value && value.constructor && value.constructor.constructor) {
|
||||||
var valueGlobal = value.constructor.constructor('return this');
|
var valueGlobal = value.constructor.constructor('return this');
|
||||||
if (j$.isFunction_(valueGlobal)) {
|
if (j$.isFunction_(valueGlobal)) {
|
||||||
|
|||||||
@@ -29,6 +29,43 @@ describe('base helpers', function() {
|
|||||||
}
|
}
|
||||||
}, 100);
|
}, 100);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('returns true for an Error subclass', function() {
|
||||||
|
function MyError() {}
|
||||||
|
MyError.prototype = new Error();
|
||||||
|
expect(jasmineUnderTest.isError_(new MyError())).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('returns true for an un-thrown Error with no message in this environment', function() {
|
||||||
|
expect(jasmineUnderTest.isError_(new Error())).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('returns true for an Error that originated from another frame', function() {
|
||||||
|
var iframe, error;
|
||||||
|
|
||||||
|
if (typeof window === 'undefined') {
|
||||||
|
pending('This test only runs in browsers.');
|
||||||
|
}
|
||||||
|
|
||||||
|
iframe = document.createElement('iframe');
|
||||||
|
iframe.style.display = 'none';
|
||||||
|
document.body.appendChild(iframe);
|
||||||
|
|
||||||
|
try {
|
||||||
|
error = iframe.contentWindow.eval('new Error()');
|
||||||
|
expect(jasmineUnderTest.isError_(error)).toBe(true);
|
||||||
|
} finally {
|
||||||
|
document.body.removeChild(iframe);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
it('returns false for a falsy value', function() {
|
||||||
|
expect(jasmineUnderTest.isError_(undefined)).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('returns false for a non-Error object', function() {
|
||||||
|
expect(jasmineUnderTest.isError_({})).toBe(false);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('isAsymmetricEqualityTester_', function() {
|
describe('isAsymmetricEqualityTester_', function() {
|
||||||
|
|||||||
@@ -99,9 +99,21 @@ getJasmineRequireObj().base = function(j$, jasmineGlobal) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
j$.isError_ = function(value) {
|
j$.isError_ = function(value) {
|
||||||
|
if (!value) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (value instanceof Error) {
|
if (value instanceof Error) {
|
||||||
return true;
|
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) {
|
if (value && value.constructor && value.constructor.constructor) {
|
||||||
var valueGlobal = value.constructor.constructor('return this');
|
var valueGlobal = value.constructor.constructor('return this');
|
||||||
if (j$.isFunction_(valueGlobal)) {
|
if (j$.isFunction_(valueGlobal)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user