@@ -1234,6 +1234,74 @@ describe("ngAnimate $animateCss", function() {
1234
1234
$timeout . flush ( ) ;
1235
1235
} ) . not . toThrow ( ) ;
1236
1236
} ) ) ;
1237
+
1238
+ it ( "should consider a positive options.delay value for the closing timeout" ,
1239
+ inject ( function ( $animateCss , $rootElement , $timeout , $document ) {
1240
+
1241
+ var element = jqLite ( '<div></div>' ) ;
1242
+ $rootElement . append ( element ) ;
1243
+ jqLite ( $document [ 0 ] . body ) . append ( $rootElement ) ;
1244
+
1245
+ var options = {
1246
+ delay : 3 ,
1247
+ duration : 3 ,
1248
+ to : {
1249
+ height : '100px'
1250
+ }
1251
+ } ;
1252
+
1253
+ var animator = $animateCss ( element , options ) ;
1254
+
1255
+ animator . start ( ) ;
1256
+ triggerAnimationStartFrame ( ) ;
1257
+
1258
+ // At this point, the animation should still be running (closing timeout is 7500ms ... duration * 1.5 + delay => 7.5)
1259
+ $timeout . flush ( 7000 ) ;
1260
+
1261
+ expect ( element . css ( prefix + 'transition-delay' ) ) . toBe ( '3s' ) ;
1262
+ expect ( element . css ( prefix + 'transition-duration' ) ) . toBe ( '3s' ) ;
1263
+
1264
+ // Let's flush the remaining amout of time for the timeout timer to kick in
1265
+ $timeout . flush ( 500 ) ;
1266
+
1267
+ dump ( element . attr ( 'style' ) ) ;
1268
+ expect ( element . css ( prefix + 'transition-duration' ) ) . toBeOneOf ( '' , '0s' ) ;
1269
+ expect ( element . css ( prefix + 'transition-delay' ) ) . toBeOneOf ( '' , '0s' ) ;
1270
+ } ) ) ;
1271
+
1272
+ it ( "should ignore a boolean options.delay value for the closing timeout" ,
1273
+ inject ( function ( $animateCss , $rootElement , $timeout , $document ) {
1274
+
1275
+ var element = jqLite ( '<div></div>' ) ;
1276
+ $rootElement . append ( element ) ;
1277
+ jqLite ( $document [ 0 ] . body ) . append ( $rootElement ) ;
1278
+
1279
+ var options = {
1280
+ delay : true ,
1281
+ duration : 3 ,
1282
+ to : {
1283
+ height : '100px'
1284
+ }
1285
+ } ;
1286
+
1287
+ var animator = $animateCss ( element , options ) ;
1288
+
1289
+ animator . start ( ) ;
1290
+ triggerAnimationStartFrame ( ) ;
1291
+
1292
+ // At this point, the animation should still be running (closing timeout is 4500ms ... duration * 1.5 => 4.5)
1293
+ $timeout . flush ( 4000 ) ;
1294
+
1295
+ expect ( element . css ( prefix + 'transition-delay' ) ) . toBeOneOf ( 'initial' , '0s' ) ;
1296
+ expect ( element . css ( prefix + 'transition-duration' ) ) . toBe ( '3s' ) ;
1297
+
1298
+ // Let's flush the remaining amout of time for the timeout timer to kick in
1299
+ $timeout . flush ( 500 ) ;
1300
+
1301
+ expect ( element . css ( prefix + 'transition-duration' ) ) . toBeOneOf ( '' , '0s' ) ;
1302
+ expect ( element . css ( prefix + 'transition-delay' ) ) . toBeOneOf ( '' , '0s' ) ;
1303
+ } ) ) ;
1304
+
1237
1305
} ) ;
1238
1306
1239
1307
describe ( "getComputedStyle" , function ( ) {
0 commit comments