Made SpyRegistry compatible with strict mode
This commit is contained in:
@@ -10017,6 +10017,8 @@ getJasmineRequireObj().SpyFactory = function(j$) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
getJasmineRequireObj().SpyRegistry = function(j$) {
|
getJasmineRequireObj().SpyRegistry = function(j$) {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
const spyOnMsg = j$.private.formatErrorMsg(
|
const spyOnMsg = j$.private.formatErrorMsg(
|
||||||
'<spyOn>',
|
'<spyOn>',
|
||||||
'spyOn(<object>, <methodName>)'
|
'spyOn(<object>, <methodName>)'
|
||||||
@@ -10099,7 +10101,10 @@ getJasmineRequireObj().SpyRegistry = function(j$) {
|
|||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
restoreStrategy = function() {
|
restoreStrategy = function() {
|
||||||
if (!delete obj[methodName]) {
|
try {
|
||||||
|
delete obj[methodName];
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
|
} catch (e) {
|
||||||
obj[methodName] = originalMethod;
|
obj[methodName] = originalMethod;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
getJasmineRequireObj().SpyRegistry = function(j$) {
|
getJasmineRequireObj().SpyRegistry = function(j$) {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
const spyOnMsg = j$.private.formatErrorMsg(
|
const spyOnMsg = j$.private.formatErrorMsg(
|
||||||
'<spyOn>',
|
'<spyOn>',
|
||||||
'spyOn(<object>, <methodName>)'
|
'spyOn(<object>, <methodName>)'
|
||||||
@@ -81,7 +83,10 @@ getJasmineRequireObj().SpyRegistry = function(j$) {
|
|||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
restoreStrategy = function() {
|
restoreStrategy = function() {
|
||||||
if (!delete obj[methodName]) {
|
try {
|
||||||
|
delete obj[methodName];
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
|
} catch (e) {
|
||||||
obj[methodName] = originalMethod;
|
obj[methodName] = originalMethod;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user