@@ -7420,22 +7420,22 @@ describe('$compile', function() {
7420
7420
} ) ;
7421
7421
7422
7422
inject ( function ( $compile , $rootScope ) {
7423
- var cacheSize = jqLiteCacheSize ( ) ;
7423
+ expect ( jqLiteCacheSize ( ) ) . toEqual ( 0 ) ;
7424
7424
7425
7425
element = $compile ( '<div><div ng-repeat="x in xs" ng-if="x==1">{{x}}</div></div>' ) ( $rootScope ) ;
7426
- expect ( jqLiteCacheSize ( ) ) . toEqual ( cacheSize + 1 ) ;
7426
+ expect ( jqLiteCacheSize ( ) ) . toEqual ( 1 ) ;
7427
7427
7428
7428
$rootScope . $apply ( 'xs = [0,1]' ) ;
7429
- expect ( jqLiteCacheSize ( ) ) . toEqual ( cacheSize + 2 ) ;
7429
+ expect ( jqLiteCacheSize ( ) ) . toEqual ( 2 ) ;
7430
7430
7431
7431
$rootScope . $apply ( 'xs = [0]' ) ;
7432
- expect ( jqLiteCacheSize ( ) ) . toEqual ( cacheSize + 1 ) ;
7432
+ expect ( jqLiteCacheSize ( ) ) . toEqual ( 1 ) ;
7433
7433
7434
7434
$rootScope . $apply ( 'xs = []' ) ;
7435
- expect ( jqLiteCacheSize ( ) ) . toEqual ( cacheSize + 1 ) ;
7435
+ expect ( jqLiteCacheSize ( ) ) . toEqual ( 1 ) ;
7436
7436
7437
7437
element . remove ( ) ;
7438
- expect ( jqLiteCacheSize ( ) ) . toEqual ( cacheSize + 0 ) ;
7438
+ expect ( jqLiteCacheSize ( ) ) . toEqual ( 0 ) ;
7439
7439
} ) ;
7440
7440
} ) ;
7441
7441
@@ -7452,22 +7452,22 @@ describe('$compile', function() {
7452
7452
} ) ;
7453
7453
7454
7454
inject ( function ( $compile , $rootScope ) {
7455
- var cacheSize = jqLiteCacheSize ( ) ;
7455
+ expect ( jqLiteCacheSize ( ) ) . toEqual ( 0 ) ;
7456
7456
7457
7457
element = $compile ( '<div><div ng-repeat="x in xs" ng-if="x==1">{{x}}</div></div>' ) ( $rootScope ) ;
7458
- expect ( jqLiteCacheSize ( ) ) . toEqual ( cacheSize ) ;
7458
+ expect ( jqLiteCacheSize ( ) ) . toEqual ( 0 ) ;
7459
7459
7460
7460
$rootScope . $apply ( 'xs = [0,1]' ) ;
7461
- expect ( jqLiteCacheSize ( ) ) . toEqual ( cacheSize ) ;
7461
+ expect ( jqLiteCacheSize ( ) ) . toEqual ( 0 ) ;
7462
7462
7463
7463
$rootScope . $apply ( 'xs = [0]' ) ;
7464
- expect ( jqLiteCacheSize ( ) ) . toEqual ( cacheSize ) ;
7464
+ expect ( jqLiteCacheSize ( ) ) . toEqual ( 0 ) ;
7465
7465
7466
7466
$rootScope . $apply ( 'xs = []' ) ;
7467
- expect ( jqLiteCacheSize ( ) ) . toEqual ( cacheSize ) ;
7467
+ expect ( jqLiteCacheSize ( ) ) . toEqual ( 0 ) ;
7468
7468
7469
7469
element . remove ( ) ;
7470
- expect ( jqLiteCacheSize ( ) ) . toEqual ( cacheSize ) ;
7470
+ expect ( jqLiteCacheSize ( ) ) . toEqual ( 0 ) ;
7471
7471
} ) ;
7472
7472
} ) ;
7473
7473
@@ -7483,26 +7483,26 @@ describe('$compile', function() {
7483
7483
} ) ;
7484
7484
7485
7485
inject ( function ( $compile , $rootScope ) {
7486
- var cacheSize = jqLiteCacheSize ( ) ;
7486
+ expect ( jqLiteCacheSize ( ) ) . toEqual ( 0 ) ;
7487
7487
element = $compile ( '<div><div ng-repeat="x in xs" ng-if="val">{{x}}</div></div>' ) ( $rootScope ) ;
7488
7488
7489
7489
$rootScope . $apply ( 'xs = [0,1]' ) ;
7490
7490
// At this point we have a bunch of comment placeholders but no real transcluded elements
7491
7491
// So the cache only contains the root element's data
7492
- expect ( jqLiteCacheSize ( ) ) . toEqual ( cacheSize + 1 ) ;
7492
+ expect ( jqLiteCacheSize ( ) ) . toEqual ( 1 ) ;
7493
7493
7494
7494
$rootScope . $apply ( 'val = true' ) ;
7495
7495
// Now we have two concrete transcluded elements plus some comments so two more cache items
7496
- expect ( jqLiteCacheSize ( ) ) . toEqual ( cacheSize + 3 ) ;
7496
+ expect ( jqLiteCacheSize ( ) ) . toEqual ( 3 ) ;
7497
7497
7498
7498
$rootScope . $apply ( 'val = false' ) ;
7499
7499
// Once again we only have comments so no transcluded elements and the cache is back to just
7500
7500
// the root element
7501
- expect ( jqLiteCacheSize ( ) ) . toEqual ( cacheSize + 1 ) ;
7501
+ expect ( jqLiteCacheSize ( ) ) . toEqual ( 1 ) ;
7502
7502
7503
7503
element . remove ( ) ;
7504
7504
// Now we've even removed the root element along with its cache
7505
- expect ( jqLiteCacheSize ( ) ) . toEqual ( cacheSize + 0 ) ;
7505
+ expect ( jqLiteCacheSize ( ) ) . toEqual ( 0 ) ;
7506
7506
} ) ;
7507
7507
} ) ;
7508
7508
@@ -7539,7 +7539,6 @@ describe('$compile', function() {
7539
7539
} ) ;
7540
7540
7541
7541
inject ( function ( $compile , $rootScope , $httpBackend , $timeout , $templateCache ) {
7542
- var cacheSize = jqLiteCacheSize ( ) ;
7543
7542
$httpBackend . whenGET ( 'red.html' ) . respond ( '<p>red.html</p>' ) ;
7544
7543
var template = $compile (
7545
7544
'<div ng-controller="Leak">' +
@@ -7554,7 +7553,7 @@ describe('$compile', function() {
7554
7553
$timeout . flush ( ) ;
7555
7554
$httpBackend . flush ( ) ;
7556
7555
expect ( linkFn ) . not . toHaveBeenCalled ( ) ;
7557
- expect ( jqLiteCacheSize ( ) ) . toEqual ( cacheSize + 2 ) ;
7556
+ expect ( jqLiteCacheSize ( ) ) . toEqual ( 2 ) ;
7558
7557
7559
7558
$templateCache . removeAll ( ) ;
7560
7559
var destroyedScope = $rootScope . $new ( ) ;
@@ -8337,7 +8336,9 @@ describe('$compile', function() {
8337
8336
8338
8337
it ( 'should not leak memory with nested transclusion' , function ( ) {
8339
8338
inject ( function ( $compile , $rootScope ) {
8340
- var size , initialSize = jqLiteCacheSize ( ) ;
8339
+ var size ;
8340
+
8341
+ expect ( jqLiteCacheSize ( ) ) . toEqual ( 0 ) ;
8341
8342
8342
8343
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>' ) ;
8343
8344
$compile ( element ) ( $rootScope . $new ( ) ) ;
@@ -8351,7 +8352,7 @@ describe('$compile', function() {
8351
8352
expect ( jqLiteCacheSize ( ) ) . toEqual ( size ) ;
8352
8353
8353
8354
element . remove ( ) ;
8354
- expect ( jqLiteCacheSize ( ) ) . toEqual ( initialSize ) ;
8355
+ expect ( jqLiteCacheSize ( ) ) . toEqual ( 0 ) ;
8355
8356
} ) ;
8356
8357
} ) ;
8357
8358
} ) ;
0 commit comments