File tree 2 files changed +27
-1
lines changed
2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -610,9 +610,14 @@ angular.module('ngAnimate', ['ng'])
610
610
}
611
611
612
612
var animations = [ ] ;
613
+
613
614
//only add animations if the currently running animation is not structural
614
615
//or if there is no animation running at all
615
- if ( ! ngAnimateState . running || ! ( isClassBased && ngAnimateState . structural ) ) {
616
+ var allowAnimations = isClassBased ?
617
+ ! ngAnimateState . disabled && ( ! ngAnimateState . running || ! ngAnimateState . structural ) :
618
+ true ;
619
+
620
+ if ( allowAnimations ) {
616
621
forEach ( matches , function ( animation ) {
617
622
//add the animation to the queue to if it is allowed to be cancelled
618
623
if ( ! animation . allowCancel || animation . allowCancel ( element , animationEvent , className ) ) {
Original file line number Diff line number Diff line change @@ -538,6 +538,27 @@ describe("ngAnimate", function() {
538
538
expect ( completed ) . toBe ( true ) ;
539
539
} ) ) ;
540
540
541
+ it ( "should skip class-based animations if animations are directly disabled on the same element" , function ( ) {
542
+ var capture ;
543
+ module ( function ( $animateProvider ) {
544
+ $animateProvider . register ( '.capture' , function ( ) {
545
+ return {
546
+ addClass : function ( element , className , done ) {
547
+ capture = true ;
548
+ done ( ) ;
549
+ }
550
+ } ;
551
+ } ) ;
552
+ } ) ;
553
+ inject ( function ( $animate , $rootScope , $sniffer , $timeout ) {
554
+ $animate . enabled ( true ) ;
555
+ $animate . enabled ( false , element ) ;
556
+
557
+ $animate . addClass ( element , 'capture' ) ;
558
+ expect ( element . hasClass ( 'capture' ) ) . toBe ( true ) ;
559
+ expect ( capture ) . not . toBe ( true ) ;
560
+ } ) ;
561
+ } ) ;
541
562
542
563
it ( "should fire the cancel/end function with the correct flag in the parameters" ,
543
564
inject ( function ( $animate , $rootScope , $sniffer , $timeout ) {
You can’t perform that action at this time.
0 commit comments