| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <meta charset=utf-8> | 2 <meta charset=utf-8> |
| 3 <title>endDelay tests</title> | 3 <title>endDelay tests</title> |
| 4 <link rel="help" href="http://w3c.github.io/web-animations/#dom-animationeffectt
iming-enddelay"> | 4 <link rel="help" href="http://w3c.github.io/web-animations/#dom-animationeffectt
iming-enddelay"> |
| 5 <link rel="author" title="Ryo Motozawa" href="mailto:motozawa@mozilla-japan.org"
> | 5 <link rel="author" title="Ryo Motozawa" href="mailto:motozawa@mozilla-japan.org"
> |
| 6 <script src="/resources/testharness.js"></script> | 6 <script src="/resources/testharness.js"></script> |
| 7 <script src="/resources/testharnessreport.js"></script> | 7 <script src="/resources/testharnessreport.js"></script> |
| 8 <script src="../../testcommon.js"></script> | 8 <script src="../../testcommon.js"></script> |
| 9 <body> | 9 <body> |
| 10 <div id="log"></div> | 10 <div id="log"></div> |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 return waitForAnimationFrames(2); | 59 return waitForAnimationFrames(2); |
| 60 }).then(t.step_func(function() { | 60 }).then(t.step_func(function() { |
| 61 t.done(); | 61 t.done(); |
| 62 })); | 62 })); |
| 63 }, 'onfinish event is not fired duration endDelay'); | 63 }, 'onfinish event is not fired duration endDelay'); |
| 64 | 64 |
| 65 async_test(function(t) { | 65 async_test(function(t) { |
| 66 var div = createDiv(t); | 66 var div = createDiv(t); |
| 67 var anim = div.animate({ opacity: [ 0, 1 ] }, | 67 var anim = div.animate({ opacity: [ 0, 1 ] }, |
| 68 { duration: 100000, endDelay: 30000 }); | 68 { duration: 100000, endDelay: 30000 }); |
| 69 var finishedTimelineTime; | |
| 70 anim.finished.then(function() { | |
| 71 finishedTimelineTime = anim.timeline.currentTime; | |
| 72 }); | |
| 73 | |
| 74 var receivedEvents = []; | |
| 75 anim.onfinish = function(event) { | |
| 76 receivedEvents.push(event); | |
| 77 } | |
| 78 | |
| 79 anim.ready.then(function() { | 69 anim.ready.then(function() { |
| 80 anim.currentTime = 110000; // during endDelay | 70 anim.currentTime = 110000; // during endDelay |
| 71 anim.onfinish = t.step_func(function(event) { |
| 72 assert_unreached('onfinish event should not be fired during endDelay'); |
| 73 }); |
| 81 return waitForAnimationFrames(2); | 74 return waitForAnimationFrames(2); |
| 82 }).then(t.step_func(function() { | 75 }).then(t.step_func(function() { |
| 83 assert_equals(receivedEvents.length, 0, | 76 anim.onfinish = t.step_func(function(event) { |
| 84 'onfinish event is should not be fired' + | 77 t.done(); |
| 85 'when currentTime is during endDelay'); | 78 }); |
| 86 anim.currentTime = 130000; // after endTime | 79 anim.currentTime = 130000; // after endTime |
| 87 return waitForAnimationFrames(2); | |
| 88 })).then(t.step_func_done(function() { | |
| 89 assert_equals(receivedEvents.length, 1, 'length of array should be one'); | |
| 90 assert_equals(receivedEvents[0].timelineTime, finishedTimelineTime, | |
| 91 'receivedEvents[0].timelineTime should equal to the animation timeline ' | |
| 92 + 'when finished promise is resolved'); | |
| 93 })); | 80 })); |
| 94 }, 'onfinish event is fired currentTime is after endTime'); | 81 }, 'onfinish event is fired currentTime is after endTime'); |
| 95 | 82 |
| 96 </script> | 83 </script> |
| 97 </body> | 84 </body> |
| OLD | NEW |