@@ -757,43 +757,29 @@ angular.mock.TzDate = function (offset, timestamp) {
757757angular . mock . TzDate . prototype = Date . prototype ;
758758/* jshint +W101 */
759759
760- // TODO(matias): remove this IMMEDIATELY once we can properly detect the
761- // presence of a registered module
762- var animateLoaded ;
763- try {
764- angular . module ( 'ngAnimate' ) ;
765- animateLoaded = true ;
766- } catch ( e ) { }
767-
768- if ( animateLoaded ) {
769- angular . module ( 'ngAnimate' ) . config ( [ '$provide' , function ( $provide ) {
760+ angular . mock . animate = angular . module ( 'ngAnimateMock' , [ 'ng' ] )
761+
762+ . config ( [ '$provide' , function ( $provide ) {
770763 var reflowQueue = [ ] ;
764+
771765 $provide . value ( '$$animateReflow' , function ( fn ) {
772766 reflowQueue . push ( fn ) ;
773767 return angular . noop ;
774768 } ) ;
775- $provide . decorator ( '$animate' , function ( $delegate ) {
776- $delegate . triggerReflow = function ( ) {
777- if ( reflowQueue . length === 0 ) {
778- throw new Error ( 'No animation reflows present' ) ;
779- }
780- angular . forEach ( reflowQueue , function ( fn ) {
781- fn ( ) ;
782- } ) ;
783- reflowQueue = [ ] ;
784- } ;
785- return $delegate ;
786- } ) ;
787- } ] ) ;
788- }
789769
790- angular . mock . animate = angular . module ( 'mock.animate' , [ 'ng' ] )
791-
792- . config ( [ '$provide' , function ( $provide ) {
793770 $provide . decorator ( '$animate' , function ( $delegate ) {
794771 var animate = {
795772 queue : [ ] ,
796773 enabled : $delegate . enabled ,
774+ triggerReflow : function ( ) {
775+ if ( reflowQueue . length === 0 ) {
776+ throw new Error ( 'No animation reflows present' ) ;
777+ }
778+ angular . forEach ( reflowQueue , function ( fn ) {
779+ fn ( ) ;
780+ } ) ;
781+ reflowQueue = [ ] ;
782+ }
797783 } ;
798784
799785 angular . forEach ( [ 'enter' , 'leave' , 'move' , 'addClass' , 'removeClass' ] , function ( method ) {
0 commit comments