@@ -249,7 +249,7 @@ describe('ngAnimate integration tests', function() {
249
249
expect ( child ) . not . toHaveClass ( 'expand-add' ) ;
250
250
} ) ) ;
251
251
252
- it ( 'should only issue a reflow for each parent CSS class change that contains ready-to-fire child animations ' , function ( ) {
252
+ it ( 'should issue a reflow for each element animation on all DOM levels ' , function ( ) {
253
253
module ( 'ngAnimateMock' ) ;
254
254
inject ( function ( $animate , $compile , $rootScope , $rootElement , $$rAF , $document ) {
255
255
element = jqLite (
@@ -273,11 +273,13 @@ describe('ngAnimate integration tests', function() {
273
273
$rootScope . items = [ 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 ] ;
274
274
275
275
$rootScope . $digest ( ) ;
276
- expect ( $animate . reflows ) . toBe ( 2 ) ;
276
+
277
+ // 2 parents + 10 items = 12
278
+ expect ( $animate . reflows ) . toBe ( 12 ) ;
277
279
} ) ;
278
280
} ) ;
279
281
280
- it ( 'should issue a reflow for each parent class-based animation that contains active child animations ' , function ( ) {
282
+ it ( 'should issue a reflow for each element and also its children ' , function ( ) {
281
283
module ( 'ngAnimateMock' ) ;
282
284
inject ( function ( $animate , $compile , $rootScope , $rootElement , $$rAF , $document ) {
283
285
element = jqLite (
@@ -302,37 +304,9 @@ describe('ngAnimate integration tests', function() {
302
304
303
305
$rootScope . exp = true ;
304
306
$rootScope . $digest ( ) ;
305
- expect ( $animate . reflows ) . toBe ( 2 ) ;
306
- } ) ;
307
- } ) ;
308
-
309
- it ( 'should only issue one reflow for class-based animations if none of them have children with queued animations' , function ( ) {
310
- module ( 'ngAnimateMock' ) ;
311
- inject ( function ( $animate , $compile , $rootScope , $rootElement , $$rAF , $document ) {
312
- element = jqLite (
313
- '<div ng-class="{one:exp}">' +
314
- '<div ng-if="exp2"></div>' +
315
- '</div>' +
316
- '<div ng-class="{two:exp}">' +
317
- '<div ng-if="exp2"></div>' +
318
- '</div>' +
319
- '<div ng-class="{three:exp}"></div>'
320
- ) ;
321
307
322
- $rootElement . append ( element ) ;
323
- jqLite ( $document [ 0 ] . body ) . append ( $rootElement ) ;
324
-
325
- $compile ( element ) ( $rootScope ) ;
326
- $rootScope . $digest ( ) ;
327
- expect ( $animate . reflows ) . toBe ( 0 ) ;
328
-
329
- $rootScope . exp = true ;
330
- $rootScope . $digest ( ) ;
331
- expect ( $animate . reflows ) . toBe ( 1 ) ;
332
-
333
- $rootScope . exp2 = true ;
334
- $rootScope . $digest ( ) ;
335
- expect ( $animate . reflows ) . toBe ( 2 ) ;
308
+ // there is one element's expression in there that is false
309
+ expect ( $animate . reflows ) . toBe ( 6 ) ;
336
310
} ) ;
337
311
} ) ;
338
312
@@ -356,7 +330,7 @@ describe('ngAnimate integration tests', function() {
356
330
$rootScope . items = [ 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 ] ;
357
331
$rootScope . $digest ( ) ;
358
332
359
- expect ( $animate . reflows ) . toBe ( 1 ) ;
333
+ expect ( $animate . reflows ) . toBe ( 10 ) ;
360
334
} ) ;
361
335
} ) ;
362
336
} ) ;
0 commit comments