@@ -6087,22 +6087,22 @@ describe('$compile', function() {
6087
6087
} ) ;
6088
6088
6089
6089
inject ( function ( $compile , $rootScope ) {
6090
- var cacheSize = jqLiteCacheSize ( ) ;
6090
+ expect ( jqLiteCacheSize ( ) ) . toEqual ( 0 ) ;
6091
6091
6092
6092
element = $compile ( '<div><div ng-repeat="x in xs" ng-if="x==1">{{x}}</div></div>' ) ( $rootScope ) ;
6093
- expect ( jqLiteCacheSize ( ) ) . toEqual ( cacheSize + 1 ) ;
6093
+ expect ( jqLiteCacheSize ( ) ) . toEqual ( 1 ) ;
6094
6094
6095
6095
$rootScope . $apply ( 'xs = [0,1]' ) ;
6096
- expect ( jqLiteCacheSize ( ) ) . toEqual ( cacheSize + 2 ) ;
6096
+ expect ( jqLiteCacheSize ( ) ) . toEqual ( 2 ) ;
6097
6097
6098
6098
$rootScope . $apply ( 'xs = [0]' ) ;
6099
- expect ( jqLiteCacheSize ( ) ) . toEqual ( cacheSize + 1 ) ;
6099
+ expect ( jqLiteCacheSize ( ) ) . toEqual ( 1 ) ;
6100
6100
6101
6101
$rootScope . $apply ( 'xs = []' ) ;
6102
- expect ( jqLiteCacheSize ( ) ) . toEqual ( cacheSize + 1 ) ;
6102
+ expect ( jqLiteCacheSize ( ) ) . toEqual ( 1 ) ;
6103
6103
6104
6104
element . remove ( ) ;
6105
- expect ( jqLiteCacheSize ( ) ) . toEqual ( cacheSize + 0 ) ;
6105
+ expect ( jqLiteCacheSize ( ) ) . toEqual ( 0 ) ;
6106
6106
} ) ;
6107
6107
} ) ;
6108
6108
@@ -6119,22 +6119,22 @@ describe('$compile', function() {
6119
6119
} ) ;
6120
6120
6121
6121
inject ( function ( $compile , $rootScope ) {
6122
- var cacheSize = jqLiteCacheSize ( ) ;
6122
+ expect ( jqLiteCacheSize ( ) ) . toEqual ( 0 ) ;
6123
6123
6124
6124
element = $compile ( '<div><div ng-repeat="x in xs" ng-if="x==1">{{x}}</div></div>' ) ( $rootScope ) ;
6125
- expect ( jqLiteCacheSize ( ) ) . toEqual ( cacheSize ) ;
6125
+ expect ( jqLiteCacheSize ( ) ) . toEqual ( 0 ) ;
6126
6126
6127
6127
$rootScope . $apply ( 'xs = [0,1]' ) ;
6128
- expect ( jqLiteCacheSize ( ) ) . toEqual ( cacheSize ) ;
6128
+ expect ( jqLiteCacheSize ( ) ) . toEqual ( 0 ) ;
6129
6129
6130
6130
$rootScope . $apply ( 'xs = [0]' ) ;
6131
- expect ( jqLiteCacheSize ( ) ) . toEqual ( cacheSize ) ;
6131
+ expect ( jqLiteCacheSize ( ) ) . toEqual ( 0 ) ;
6132
6132
6133
6133
$rootScope . $apply ( 'xs = []' ) ;
6134
- expect ( jqLiteCacheSize ( ) ) . toEqual ( cacheSize ) ;
6134
+ expect ( jqLiteCacheSize ( ) ) . toEqual ( 0 ) ;
6135
6135
6136
6136
element . remove ( ) ;
6137
- expect ( jqLiteCacheSize ( ) ) . toEqual ( cacheSize ) ;
6137
+ expect ( jqLiteCacheSize ( ) ) . toEqual ( 0 ) ;
6138
6138
} ) ;
6139
6139
} ) ;
6140
6140
@@ -6150,26 +6150,26 @@ describe('$compile', function() {
6150
6150
} ) ;
6151
6151
6152
6152
inject ( function ( $compile , $rootScope ) {
6153
- var cacheSize = jqLiteCacheSize ( ) ;
6153
+ expect ( jqLiteCacheSize ( ) ) . toEqual ( 0 ) ;
6154
6154
element = $compile ( '<div><div ng-repeat="x in xs" ng-if="val">{{x}}</div></div>' ) ( $rootScope ) ;
6155
6155
6156
6156
$rootScope . $apply ( 'xs = [0,1]' ) ;
6157
6157
// At this point we have a bunch of comment placeholders but no real transcluded elements
6158
6158
// So the cache only contains the root element's data
6159
- expect ( jqLiteCacheSize ( ) ) . toEqual ( cacheSize + 1 ) ;
6159
+ expect ( jqLiteCacheSize ( ) ) . toEqual ( 1 ) ;
6160
6160
6161
6161
$rootScope . $apply ( 'val = true' ) ;
6162
6162
// Now we have two concrete transcluded elements plus some comments so two more cache items
6163
- expect ( jqLiteCacheSize ( ) ) . toEqual ( cacheSize + 3 ) ;
6163
+ expect ( jqLiteCacheSize ( ) ) . toEqual ( 3 ) ;
6164
6164
6165
6165
$rootScope . $apply ( 'val = false' ) ;
6166
6166
// Once again we only have comments so no transcluded elements and the cache is back to just
6167
6167
// the root element
6168
- expect ( jqLiteCacheSize ( ) ) . toEqual ( cacheSize + 1 ) ;
6168
+ expect ( jqLiteCacheSize ( ) ) . toEqual ( 1 ) ;
6169
6169
6170
6170
element . remove ( ) ;
6171
6171
// Now we've even removed the root element along with its cache
6172
- expect ( jqLiteCacheSize ( ) ) . toEqual ( cacheSize + 0 ) ;
6172
+ expect ( jqLiteCacheSize ( ) ) . toEqual ( 0 ) ;
6173
6173
} ) ;
6174
6174
} ) ;
6175
6175
@@ -6206,7 +6206,6 @@ describe('$compile', function() {
6206
6206
} ) ;
6207
6207
6208
6208
inject ( function ( $compile , $rootScope , $httpBackend , $timeout , $templateCache ) {
6209
- var cacheSize = jqLiteCacheSize ( ) ;
6210
6209
$httpBackend . whenGET ( 'red.html' ) . respond ( '<p>red.html</p>' ) ;
6211
6210
var template = $compile (
6212
6211
'<div ng-controller="Leak">' +
@@ -6221,7 +6220,7 @@ describe('$compile', function() {
6221
6220
$timeout . flush ( ) ;
6222
6221
$httpBackend . flush ( ) ;
6223
6222
expect ( linkFn ) . not . toHaveBeenCalled ( ) ;
6224
- expect ( jqLiteCacheSize ( ) ) . toEqual ( cacheSize + 2 ) ;
6223
+ expect ( jqLiteCacheSize ( ) ) . toEqual ( 2 ) ;
6225
6224
6226
6225
$templateCache . removeAll ( ) ;
6227
6226
var destroyedScope = $rootScope . $new ( ) ;
@@ -6984,7 +6983,9 @@ describe('$compile', function() {
6984
6983
6985
6984
it ( 'should not leak memory with nested transclusion' , function ( ) {
6986
6985
inject ( function ( $compile , $rootScope ) {
6987
- var size , initialSize = jqLiteCacheSize ( ) ;
6986
+ var size ;
6987
+
6988
+ expect ( jqLiteCacheSize ( ) ) . toEqual ( 0 ) ;
6988
6989
6989
6990
element = jqLite ( '<div><ul><li ng-repeat="n in nums">{{n}} => <i ng-if="0 === n%2">Even</i><i ng-if="1 === n%2">Odd</i></li></ul></div>' ) ;
6990
6991
$compile ( element ) ( $rootScope . $new ( ) ) ;
@@ -6998,7 +6999,7 @@ describe('$compile', function() {
6998
6999
expect ( jqLiteCacheSize ( ) ) . toEqual ( size ) ;
6999
7000
7000
7001
element . remove ( ) ;
7001
- expect ( jqLiteCacheSize ( ) ) . toEqual ( initialSize ) ;
7002
+ expect ( jqLiteCacheSize ( ) ) . toEqual ( 0 ) ;
7002
7003
} ) ;
7003
7004
} ) ;
7004
7005
} ) ;
0 commit comments