@@ -757,43 +757,29 @@ angular.mock.TzDate = function (offset, timestamp) {
757
757
angular . mock . TzDate . prototype = Date . prototype ;
758
758
/* jshint +W101 */
759
759
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 ) {
770
763
var reflowQueue = [ ] ;
764
+
771
765
$provide . value ( '$$animateReflow' , function ( fn ) {
772
766
reflowQueue . push ( fn ) ;
773
767
return angular . noop ;
774
768
} ) ;
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
- }
789
769
790
- angular . mock . animate = angular . module ( 'mock.animate' , [ 'ng' ] )
791
-
792
- . config ( [ '$provide' , function ( $provide ) {
793
770
$provide . decorator ( '$animate' , function ( $delegate ) {
794
771
var animate = {
795
772
queue : [ ] ,
796
773
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
+ }
797
783
} ;
798
784
799
785
angular . forEach ( [ 'enter' , 'leave' , 'move' , 'addClass' , 'removeClass' ] , function ( method ) {
0 commit comments