@@ -32,12 +32,6 @@ describe("ngAnimate", function() {
3232
3333 describe ( "enable / disable" , function ( ) {
3434
35- beforeEach ( function ( ) {
36- module ( function ( $animateProvider , $provide ) {
37- $provide . value ( '$window' , angular . mock . createMockWindow ( ) ) ;
38- } ) ;
39- } ) ;
40-
4135 it ( "should disable and enable the animations" , function ( ) {
4236 var $animate , initialState = null ;
4337
@@ -259,8 +253,8 @@ describe("ngAnimate", function() {
259253
260254 $animate . removeClass ( element , 'ng-hide' ) ;
261255 if ( $sniffer . transitions ) {
262- $timeout . flushNext ( 1 ) ;
263256 $timeout . flushNext ( 0 ) ;
257+ $timeout . flushNext ( 1 ) ;
264258 }
265259 $timeout . flushNext ( 0 ) ;
266260 expect ( element . text ( ) ) . toBe ( 'memento' ) ;
@@ -510,7 +504,7 @@ describe("ngAnimate", function() {
510504 } ) ) ;
511505
512506 it ( "should skip animations if disabled and run when enabled" ,
513- inject ( function ( $animate , $rootScope , $compile , $sniffer ) {
507+ inject ( function ( $animate , $rootScope , $compile , $sniffer , $timeout ) {
514508 $animate . enabled ( false ) ;
515509 var style = 'animation: some_animation 2s linear 0s 1 alternate;' +
516510 vendorPrefix + 'animation: some_animation 2s linear 0s 1 alternate;'
@@ -519,6 +513,7 @@ describe("ngAnimate", function() {
519513 element . addClass ( 'ng-hide' ) ;
520514 expect ( element ) . toBeHidden ( ) ;
521515 $animate . removeClass ( element , 'ng-hide' ) ;
516+ $timeout . flush ( ) ;
522517 expect ( element ) . toBeShown ( ) ;
523518 } ) ) ;
524519
@@ -563,9 +558,9 @@ describe("ngAnimate", function() {
563558 element . addClass ( 'ng-hide' ) ;
564559 expect ( element ) . toBeHidden ( ) ;
565560 $animate . removeClass ( element , 'ng-hide' ) ;
566- expect ( element ) . toBeShown ( ) ;
567-
568561 $timeout . flushNext ( 0 ) ;
562+ $timeout . flushNext ( 0 ) ;
563+ expect ( element ) . toBeShown ( ) ;
569564
570565 $animate . enabled ( true ) ;
571566
@@ -591,6 +586,7 @@ describe("ngAnimate", function() {
591586 $timeout . flushNext ( 1 ) ;
592587 $timeout . flushNext ( 2000 ) ;
593588 }
589+ $timeout . flush ( ) ;
594590 expect ( element ) . toBeShown ( ) ;
595591 } ) ) ;
596592
@@ -604,10 +600,10 @@ describe("ngAnimate", function() {
604600
605601 element . addClass ( 'ng-hide' ) ;
606602 $animate . removeClass ( element , 'ng-hide' ) ;
603+ $timeout . flushNext ( 0 ) ;
604+ $timeout . flushNext ( 0 ) ;
607605 expect ( element ) . toBeShown ( ) ;
608606
609- $timeout . flushNext ( 0 ) ; //callback which is called
610-
611607 $animate . enabled ( true ) ;
612608
613609 element . addClass ( 'ng-hide' ) ;
@@ -618,7 +614,7 @@ describe("ngAnimate", function() {
618614 $timeout . flushNext ( 1 ) ;
619615 $timeout . flushNext ( 3000 ) ;
620616 }
621- $timeout . flushNext ( 0 ) ;
617+ $timeout . flush ( ) ;
622618 expect ( element ) . toBeShown ( ) ;
623619 } ) ) ;
624620
0 commit comments