aboutsummaryrefslogtreecommitdiffstats
path: root/test/testabilityPatch.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/testabilityPatch.js')
-rw-r--r--test/testabilityPatch.js16
1 files changed, 13 insertions, 3 deletions
diff --git a/test/testabilityPatch.js b/test/testabilityPatch.js
index 85c844cb..1b4f11ba 100644
--- a/test/testabilityPatch.js
+++ b/test/testabilityPatch.js
@@ -61,9 +61,19 @@ afterEach(function() {
function dealoc(obj) {
if (obj) {
- var element = obj.$element || obj || {};
- if (element.nodeName) element = jqLite(element);
- if (element.dealoc) element.dealoc();
+ if (isElement(obj)) {
+ var element = obj;
+ if (element.nodeName) element = jqLite(element);
+ if (element.dealoc) element.dealoc();
+ } else {
+ for(var key in jqCache) {
+ var value = jqCache[key];
+ if (value.$scope == obj) {
+ delete jqCache[key];
+ }
+ }
+ }
+
}
}