@@ -756,25 +756,35 @@ angular.mock.TzDate = function (offset, timestamp) {
756
756
angular . mock . TzDate . prototype = Date . prototype ;
757
757
/* jshint +W101 */
758
758
759
- angular . module ( 'ngAnimate' ) . config ( [ '$provide' , function ( $provide ) {
760
- var reflowQueue = [ ] ;
761
- $provide . value ( '$$animateReflow' , function ( fn ) {
762
- reflowQueue . push ( fn ) ;
763
- return angular . noop ;
764
- } ) ;
765
- $provide . decorator ( '$animate' , function ( $delegate ) {
766
- $delegate . triggerReflow = function ( ) {
767
- if ( reflowQueue . length === 0 ) {
768
- throw new Error ( 'No animation reflows present' ) ;
769
- }
770
- angular . forEach ( reflowQueue , function ( fn ) {
771
- fn ( ) ;
772
- } ) ;
773
- reflowQueue = [ ] ;
774
- } ;
775
- return $delegate ;
776
- } ) ;
777
- } ] ) ;
759
+ // TODO(matias): remove this IMMEDIATELY once we can properly detect the
760
+ // presence of a registered module
761
+ var animateLoaded ;
762
+ try {
763
+ angular . module ( 'ngAnimate' ) ;
764
+ animateLoaded = true ;
765
+ } catch ( e ) { }
766
+
767
+ if ( animateLoaded ) {
768
+ angular . module ( 'ngAnimate' ) . config ( [ '$provide' , function ( $provide ) {
769
+ var reflowQueue = [ ] ;
770
+ $provide . value ( '$$animateReflow' , function ( fn ) {
771
+ reflowQueue . push ( fn ) ;
772
+ return angular . noop ;
773
+ } ) ;
774
+ $provide . decorator ( '$animate' , function ( $delegate ) {
775
+ $delegate . triggerReflow = function ( ) {
776
+ if ( reflowQueue . length === 0 ) {
777
+ throw new Error ( 'No animation reflows present' ) ;
778
+ }
779
+ angular . forEach ( reflowQueue , function ( fn ) {
780
+ fn ( ) ;
781
+ } ) ;
782
+ reflowQueue = [ ] ;
783
+ } ;
784
+ return $delegate ;
785
+ } ) ;
786
+ } ] ) ;
787
+ }
778
788
779
789
angular . mock . animate = angular . module ( 'mock.animate' , [ 'ng' ] )
780
790
0 commit comments