IE 8 doesn't support defineProperty on non-DOM nodes, skip that kindof thing
This commit is contained in:
@@ -38,6 +38,9 @@ describe("SpyRegistry", function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("checks if it can be spied upon", function() {
|
it("checks if it can be spied upon", function() {
|
||||||
|
// IE 8 doesn't support `definePropery` on non-DOM nodes
|
||||||
|
if (jasmine.getEnv().ieVersion < 9) { return; }
|
||||||
|
|
||||||
var scope = {};
|
var scope = {};
|
||||||
|
|
||||||
function myFunc() {
|
function myFunc() {
|
||||||
|
|||||||
@@ -22,7 +22,13 @@ getJasmineRequireObj().SpyRegistry = function(j$) {
|
|||||||
throw new Error(methodName + ' has already been spied upon');
|
throw new Error(methodName + ' has already been spied upon');
|
||||||
}
|
}
|
||||||
|
|
||||||
var descriptor = Object.getOwnPropertyDescriptor(obj, methodName);
|
var descriptor = undefined;
|
||||||
|
try {
|
||||||
|
descriptor = Object.getOwnPropertyDescriptor(obj, methodName);
|
||||||
|
} catch(e) {
|
||||||
|
// IE 8 doesn't support `definePropery` on non-DOM nodes
|
||||||
|
}
|
||||||
|
|
||||||
if (descriptor && !(descriptor.writable || descriptor.set)) {
|
if (descriptor && !(descriptor.writable || descriptor.set)) {
|
||||||
throw new Error(methodName + ' is not declared writable or has no setter');
|
throw new Error(methodName + ' is not declared writable or has no setter');
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user