@@ -814,7 +814,7 @@ describe("ngAnimate", function() {
814814 $timeout . flush ( ) ;
815815
816816 expect ( child . attr ( 'style' ) || '' ) . not . toContain ( 'transition-property' ) ;
817- expect ( child . hasClass ( 'ng-animate' ) ) . toBe ( true ) ;
817+ expect ( child . hasClass ( 'ng-animate-start ' ) ) . toBe ( true ) ;
818818 expect ( child . hasClass ( 'ng-animate-active' ) ) . toBe ( true ) ;
819819
820820 browserTrigger ( child , 'transitionend' , { timeStamp : Date . now ( ) + 1000 , elapsedTime : 1000 } ) ;
@@ -845,6 +845,53 @@ describe("ngAnimate", function() {
845845 expect ( child2 . hasClass ( 'ng-animate-active' ) ) . toBe ( false ) ;
846846 } ) ) ;
847847
848+ it ( "should not apply the fallback classes if no animations are going on or if CSS animations are going on" ,
849+ inject ( function ( $compile , $rootScope , $animate , $sniffer , $timeout ) {
850+
851+ if ( ! $sniffer . animations ) return ;
852+
853+ ss . addRule ( '.transitions' , '-webkit-transition:1s linear all;' +
854+ 'transition:1s linear all' ) ;
855+
856+ ss . addRule ( '.keyframes' , '-webkit-animation:my_animation 1s;' +
857+ 'animation:my_animation 1s' ) ;
858+
859+ var element = $compile ( '<div class="transitions">...</div>' ) ( $rootScope ) ;
860+ $rootElement . append ( element ) ;
861+ jqLite ( $document [ 0 ] . body ) . append ( $rootElement ) ;
862+
863+ $animate . enabled ( false ) ;
864+
865+ $animate . addClass ( element , 'klass' ) ;
866+
867+ expect ( element . hasClass ( 'ng-animate-start' ) ) . toBe ( false ) ;
868+
869+ element . removeClass ( 'klass' ) ;
870+
871+ $animate . enabled ( true ) ;
872+
873+ $animate . addClass ( element , 'klass' ) ;
874+
875+ $timeout . flush ( ) ;
876+
877+ expect ( element . hasClass ( 'ng-animate-start' ) ) . toBe ( true ) ;
878+ expect ( element . hasClass ( 'ng-animate-active' ) ) . toBe ( true ) ;
879+
880+ browserTrigger ( element , 'transitionend' , { timeStamp : Date . now ( ) + 1000 , elapsedTime : 1 } ) ;
881+
882+ expect ( element . hasClass ( 'ng-animate-start' ) ) . toBe ( false ) ;
883+ expect ( element . hasClass ( 'ng-animate-active' ) ) . toBe ( false ) ;
884+
885+ element . attr ( 'class' , 'keyframes' ) ;
886+
887+ $animate . addClass ( element , 'klass2' ) ;
888+
889+ $timeout . flush ( ) ;
890+
891+ expect ( element . hasClass ( 'ng-animate-start' ) ) . toBe ( false ) ;
892+ expect ( element . hasClass ( 'ng-animate-active' ) ) . toBe ( false ) ;
893+ } ) ) ;
894+
848895 it ( "should skip transitions if disabled and run when enabled" ,
849896 inject ( function ( $animate , $rootScope , $compile , $sniffer , $timeout ) {
850897
0 commit comments