diff --git a/test/ng/compileSpec.js b/test/ng/compileSpec.js
index 415d9d403dbe..2b0c79107ba5 100755
--- a/test/ng/compileSpec.js
+++ b/test/ng/compileSpec.js
@@ -3927,6 +3927,33 @@ describe('$compile', function() {
});
});
+ it('should not leak memory with nested transclusion', function() {
+ var calcCacheSize = function() {
+ var size = 0;
+ forEach(jqLite.cache, function(item, key) { size++; });
+ return size;
+ };
+
+ inject(function($compile, $rootScope) {
+ var size;
+
+ expect(calcCacheSize()).toEqual(0);
+
+ element = jqLite('
');
+ $compile(element)($rootScope.$new());
+
+ $rootScope.nums = [0,1,2];
+ $rootScope.$apply();
+ size = calcCacheSize();
+
+ $rootScope.nums = [3,4,5];
+ $rootScope.$apply();
+ expect(calcCacheSize()).toEqual(size);
+
+ element.remove();
+ expect(calcCacheSize()).toEqual(0);
+ });
+ });
it('should remove transclusion scope, when the DOM is destroyed', function() {
module(function() {
@@ -3950,7 +3977,7 @@ describe('$compile', function() {
$rootScope.username = 'Misko';
$rootScope.select = true;
element = $compile(
- '')
+ '')
($rootScope);
$rootScope.$apply();
expect(element.text()).toEqual('Hello: Misko!user: Misko');