@@ -367,7 +367,7 @@ describe('ngInclude', function() {
367367 } ) ;
368368
369369 expect ( autoScrollSpy ) . not . toHaveBeenCalled ( ) ;
370- $animate . flushNext ( 'enter' ) ;
370+ expect ( $animate . queue . shift ( ) . event ) . toBe ( 'enter' ) ;
371371 $timeout . flush ( ) ;
372372
373373 expect ( autoScrollSpy ) . toHaveBeenCalledOnce ( ) ;
@@ -384,25 +384,25 @@ describe('ngInclude', function() {
384384 $rootScope . value = true ;
385385 } ) ;
386386
387- $animate . flushNext ( 'enter' ) ;
387+ expect ( $animate . queue . shift ( ) . event ) . toBe ( 'enter' ) ;
388388 $timeout . flush ( ) ;
389389
390390 $rootScope . $apply ( function ( ) {
391391 $rootScope . tpl = 'another.html' ;
392392 $rootScope . value = 'some-string' ;
393393 } ) ;
394394
395- $animate . flushNext ( 'leave' ) ;
396- $animate . flushNext ( 'enter' ) ;
395+ expect ( $animate . queue . shift ( ) . event ) . toBe ( 'leave' ) ;
396+ expect ( $animate . queue . shift ( ) . event ) . toBe ( 'enter' ) ;
397397 $timeout . flush ( ) ;
398398
399399 $rootScope . $apply ( function ( ) {
400400 $rootScope . tpl = 'template.html' ;
401401 $rootScope . value = 100 ;
402402 } ) ;
403403
404- $animate . flushNext ( 'leave' ) ;
405- $animate . flushNext ( 'enter' ) ;
404+ expect ( $animate . queue . shift ( ) . event ) . toBe ( 'leave' ) ;
405+ expect ( $animate . queue . shift ( ) . event ) . toBe ( 'enter' ) ;
406406 $timeout . flush ( ) ;
407407
408408 expect ( autoScrollSpy ) . toHaveBeenCalled ( ) ;
@@ -418,7 +418,7 @@ describe('ngInclude', function() {
418418 $rootScope . tpl = 'template.html' ;
419419 } ) ;
420420
421- $animate . flushNext ( 'enter' ) ;
421+ expect ( $animate . queue . shift ( ) . event ) . toBe ( 'enter' ) ;
422422 $timeout . flush ( ) ;
423423 expect ( autoScrollSpy ) . not . toHaveBeenCalled ( ) ;
424424 } ) ) ;
@@ -434,7 +434,7 @@ describe('ngInclude', function() {
434434 $rootScope . value = false ;
435435 } ) ;
436436
437- $animate . flushNext ( 'enter' ) ;
437+ expect ( $animate . queue . shift ( ) . event ) . toBe ( 'enter' ) ;
438438 $timeout . flush ( ) ;
439439
440440 $rootScope . $apply ( function ( ) {
@@ -456,7 +456,7 @@ describe('ngInclude', function() {
456456 expect ( autoScrollSpy ) . not . toHaveBeenCalled ( ) ;
457457
458458 $rootScope . $apply ( "tpl = 'template.html'" ) ;
459- $animate . flushNext ( 'enter' ) ;
459+ expect ( $animate . queue . shift ( ) . event ) . toBe ( 'enter' ) ;
460460 $timeout . flush ( ) ;
461461
462462 expect ( autoScrollSpy ) . toHaveBeenCalledOnce ( ) ;
@@ -608,8 +608,9 @@ describe('ngInclude animations', function() {
608608 ) ) ( $rootScope ) ;
609609 $rootScope . $digest ( ) ;
610610
611- item = $animate . flushNext ( 'enter' ) . element ;
612- expect ( item . text ( ) ) . toBe ( 'data' ) ;
611+ var animation = $animate . queue . pop ( ) ;
612+ expect ( animation . event ) . toBe ( 'enter' ) ;
613+ expect ( animation . element . text ( ) ) . toBe ( 'data' ) ;
613614 } ) ) ;
614615
615616 it ( 'should fire off the leave animation' ,
@@ -624,14 +625,16 @@ describe('ngInclude animations', function() {
624625 ) ) ( $rootScope ) ;
625626 $rootScope . $digest ( ) ;
626627
627- item = $animate . flushNext ( 'enter' ) . element ;
628- expect ( item . text ( ) ) . toBe ( 'data' ) ;
628+ var animation = $animate . queue . shift ( ) ;
629+ expect ( animation . event ) . toBe ( 'enter' ) ;
630+ expect ( animation . element . text ( ) ) . toBe ( 'data' ) ;
629631
630632 $rootScope . tpl = '' ;
631633 $rootScope . $digest ( ) ;
632634
633- item = $animate . flushNext ( 'leave' ) . element ;
634- expect ( item . text ( ) ) . toBe ( 'data' ) ;
635+ animation = $animate . queue . shift ( ) ;
636+ expect ( animation . event ) . toBe ( 'leave' ) ;
637+ expect ( animation . element . text ( ) ) . toBe ( 'data' ) ;
635638 } ) ) ;
636639
637640 it ( 'should animate two separate ngInclude elements' ,
@@ -647,14 +650,14 @@ describe('ngInclude animations', function() {
647650 ) ) ( $rootScope ) ;
648651 $rootScope . $digest ( ) ;
649652
650- item = $animate . flushNext ( 'enter' ) . element ;
651- expect ( item . text ( ) ) . toBe ( 'one' ) ;
653+ var item1 = $animate . queue . shift ( ) . element ;
654+ expect ( item1 . text ( ) ) . toBe ( 'one' ) ;
652655
653656 $rootScope . tpl = 'two' ;
654657 $rootScope . $digest ( ) ;
655658
656- var itemA = $animate . flushNext ( 'leave' ) . element ;
657- var itemB = $animate . flushNext ( 'enter' ) . element ;
659+ var itemA = $animate . queue . shift ( ) . element ;
660+ var itemB = $animate . queue . shift ( ) . element ;
658661 expect ( itemA . attr ( 'ng-include' ) ) . toBe ( 'tpl' ) ;
659662 expect ( itemB . attr ( 'ng-include' ) ) . toBe ( 'tpl' ) ;
660663 expect ( itemA ) . not . toEqual ( itemB ) ;
0 commit comments