File tree Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Expand file tree Collapse file tree 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'])
610610 }
611611
612612 var animations = [ ] ;
613+
613614 //only add animations if the currently running animation is not structural
614615 //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 ) {
616621 forEach ( matches , function ( animation ) {
617622 //add the animation to the queue to if it is allowed to be cancelled
618623 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() {
538538 expect ( completed ) . toBe ( true ) ;
539539 } ) ) ;
540540
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+ } ) ;
541562
542563 it ( "should fire the cancel/end function with the correct flag in the parameters" ,
543564 inject ( function ( $animate , $rootScope , $sniffer , $timeout ) {
You can’t perform that action at this time.
0 commit comments