@@ -410,6 +410,59 @@ describe("ngAnimate $$animateCssDriver", function() {
410410 expect ( anchorDetails . event ) . toBeFalsy ( ) ;
411411 } ) ) ;
412412
413+ they ( "should only fire the ng-anchor-$prop animation if only a $prop animation is defined" ,
414+ [ 'out' , 'in' ] , function ( direction ) {
415+
416+ var expectedClass = 'ng-anchor-' + direction ;
417+ var animationStarted ;
418+ var runner ;
419+
420+ module ( function ( $provide ) {
421+ $provide . factory ( '$animateCss' , function ( $$AnimateRunner ) {
422+ return function ( element , options ) {
423+ var addClass = ( options . addClass || '' ) . trim ( ) ;
424+ if ( addClass === expectedClass ) {
425+ return {
426+ start : function ( ) {
427+ animationStarted = addClass ;
428+ return runner = new $$AnimateRunner ( ) ;
429+ }
430+ } ;
431+ }
432+ } ;
433+ } ) ;
434+ } ) ;
435+
436+ inject ( function ( $rootElement , $$rAF ) {
437+ var fromAnchor = jqLite ( '<div></div>' ) ;
438+ from . append ( fromAnchor ) ;
439+ var toAnchor = jqLite ( '<div></div>' ) ;
440+ to . append ( toAnchor ) ;
441+
442+ $rootElement . append ( fromAnchor ) ;
443+ $rootElement . append ( toAnchor ) ;
444+
445+ var complete = false ;
446+
447+ driver ( {
448+ from : fromAnimation ,
449+ to : toAnimation ,
450+ anchors : [ {
451+ 'out' : fromAnchor ,
452+ 'in' : toAnchor
453+ } ]
454+ } ) . start ( ) . done ( function ( ) {
455+ complete = true ;
456+ } ) ;
457+
458+ expect ( animationStarted ) . toBe ( expectedClass ) ;
459+ runner . end ( ) ;
460+ $$rAF . flush ( ) ;
461+ expect ( complete ) . toBe ( true ) ;
462+ } ) ;
463+ } ) ;
464+
465+
413466 it ( "should provide an explicit delay setting in the options provided to $animateCss for anchor animations" ,
414467 inject ( function ( $rootElement ) {
415468
0 commit comments