@@ -1234,6 +1234,69 @@ 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' ) ) . toContain ( '3s' ) ;
1262
+
1263
+ // Let's flush the remaining amout of time for the timeout timer to kick in
1264
+ $timeout . flush ( 500 ) ;
1265
+
1266
+ expect ( element . css ( prefix + 'transition-delay' ) ) . toBe ( '' ) ;
1267
+ } ) ) ;
1268
+
1269
+ it ( "should ignore a boolean options.delay value for the closing timeout" ,
1270
+ inject ( function ( $animateCss , $rootElement , $timeout , $document ) {
1271
+
1272
+ var element = jqLite ( '<div></div>' ) ;
1273
+ $rootElement . append ( element ) ;
1274
+ jqLite ( $document [ 0 ] . body ) . append ( $rootElement ) ;
1275
+
1276
+ var options = {
1277
+ delay : true ,
1278
+ duration : 3 ,
1279
+ to : {
1280
+ height : '100px'
1281
+ }
1282
+ } ;
1283
+
1284
+ var animator = $animateCss ( element , options ) ;
1285
+
1286
+ animator . start ( ) ;
1287
+ triggerAnimationStartFrame ( ) ;
1288
+
1289
+ // At this point, the animation should still be running (closing timeout is 4500ms ... duration * 1.5 => 4.5)
1290
+ $timeout . flush ( 4000 ) ;
1291
+
1292
+ expect ( element . css ( prefix + 'transition-delay' ) ) . toBeOneOf ( 'initial' , '0s' ) ;
1293
+
1294
+ // Let's flush the remaining amout of time for the timeout timer to kick in
1295
+ $timeout . flush ( 500 ) ;
1296
+
1297
+ expect ( element . css ( prefix + 'transition-delay' ) ) . toBe ( '' ) ;
1298
+ } ) ) ;
1299
+
1237
1300
} ) ;
1238
1301
1239
1302
describe ( "getComputedStyle" , function ( ) {
0 commit comments