aboutsummaryrefslogtreecommitdiffstats
path: root/test/testabilityPatch.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/testabilityPatch.js')
-rw-r--r--test/testabilityPatch.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/testabilityPatch.js b/test/testabilityPatch.js
index e8041ac7..ea5c8ab7 100644
--- a/test/testabilityPatch.js
+++ b/test/testabilityPatch.js
@@ -50,6 +50,25 @@ beforeEach(function(){
});
});
+afterEach(clearJqCache);
+
+function clearJqCache(){
+ var count = 0;
+ foreachSorted(jqCache, function(value, key){
+ count ++;
+ delete jqCache[key];
+ foreach(value, function(value, key){
+ if (value.$element)
+ dump(key, sortedHtml(value.$element));
+ else
+ dump(key, toJson(value));
+ });
+ });
+ if (count) {
+ fail('Found jqCache references that were not deallocated!');
+ }
+}
+
function nakedExpect(obj) {
return expect(angular.fromJson(angular.toJson(obj)));
}
@@ -58,6 +77,11 @@ function childNode(element, index) {
return jqLite(element[0].childNodes[index]);
}
+function dealoc(obj) {
+ var element = (obj||{}).$element || obj;
+ if (element && element.dealoc) element.dealoc();
+}
+
extend(angular, {
'element': jqLite,
'compile': compile,