aboutsummaryrefslogtreecommitdiffstats
path: root/test/ng/directive
diff options
context:
space:
mode:
Diffstat (limited to 'test/ng/directive')
-rw-r--r--test/ng/directive/ngSwitchSpec.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/ng/directive/ngSwitchSpec.js b/test/ng/directive/ngSwitchSpec.js
index 66ae5562..ee91f79d 100644
--- a/test/ng/directive/ngSwitchSpec.js
+++ b/test/ng/directive/ngSwitchSpec.js
@@ -90,4 +90,19 @@ describe('ngSwitch', function() {
expect(child2).toBeDefined();
expect(child2).not.toBe(child1);
}));
+
+
+ it('should not leak jq data when compiled but not attached to parent when parent is destroyed',
+ inject(function($rootScope, $compile) {
+ element = $compile(
+ '<div ng-repeat="i in []">' +
+ '<ng-switch on="url">' +
+ '<div ng-switch-when="a">{{name}}</div>' +
+ '</ng-switch>' +
+ '</div>')($rootScope);
+ $rootScope.$apply();
+
+ // element now contains only empty repeater. this element is dealocated by local afterEach.
+ // afterwards a global afterEach will check for leaks in jq data cache object
+ }));
});