File tree 2 files changed +22
-1
lines changed
2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -240,7 +240,7 @@ var $AnimatorProvider = function() {
240
240
beforeFn ( element , parent , after ) ;
241
241
if ( element . length == 0 ) return done ( ) ;
242
242
243
- var memento = ( noop || polyfillSetup ) ( element ) ;
243
+ var memento = ( polyfillSetup || noop ) ( element ) ;
244
244
245
245
// $window.setTimeout(beginAnimation, 0); this was causing the element not to animate
246
246
// keep at 1 for animation dom rerender
Original file line number Diff line number Diff line change @@ -76,6 +76,17 @@ describe("$animator", function() {
76
76
}
77
77
}
78
78
} ) ;
79
+ $animationProvider . register ( 'setup-memo' , function ( ) {
80
+ return {
81
+ setup : function ( element ) {
82
+ return "memento" ;
83
+ } ,
84
+ start : function ( element , done , memento ) {
85
+ element . text ( memento ) ;
86
+ done ( ) ;
87
+ }
88
+ }
89
+ } ) ;
79
90
} )
80
91
inject ( function ( $animator , $compile , $rootScope ) {
81
92
element = $compile ( '<div></div>' ) ( $rootScope ) ;
@@ -185,6 +196,16 @@ describe("$animator", function() {
185
196
expect ( child . attr ( 'class' ) ) . toContain ( 'custom-leave-start' ) ;
186
197
window . setTimeout . expect ( 0 ) . process ( ) ;
187
198
} ) ) ;
199
+
200
+ it ( "should run polyfillSetup and return the memento" , inject ( function ( $animator , $rootScope ) {
201
+ animator = $animator ( $rootScope , {
202
+ ngAnimate : '{show: \'setup-memo\'}'
203
+ } ) ;
204
+ expect ( element . text ( ) ) . toEqual ( '' ) ;
205
+ animator . show ( element ) ;
206
+ window . setTimeout . expect ( 1 ) . process ( ) ;
207
+ expect ( element . text ( ) ) . toBe ( 'memento' ) ;
208
+ } ) ) ;
188
209
} ) ;
189
210
190
211
it ( "should throw an error when an invalid ng-animate syntax is provided" , inject ( function ( $compile , $rootScope ) {
You can’t perform that action at this time.
0 commit comments