[LFC][IFC] Add support for preserved new line (pre, pre-wrap, break-spaces, pre-line)
[WebKit-https.git] / LayoutTests / imported / mozilla / css-transitions / test_animation-finished.html
1 <!doctype html>
2 <meta charset=utf-8>
3 <script src="../../../resources/testharness.js"></script>
4 <script src="../../../resources/testharnessreport.js"></script>
5 <script src="../resources/testcommon.js"></script>
6 <style>
7
8 .animated-div {
9   margin-left: 100px;
10   transition: margin-left 1000s linear 1000s;
11 }
12
13 </style>
14 <body>
15 <div id="log"></div>
16 <script>
17
18 'use strict';
19
20 const ANIM_DELAY_MS = 1000000; // 1000s
21 const ANIM_DUR_MS = 1000000; // 1000s
22
23 async_test(function(t) {
24   var div = addDiv(t, {'class': 'animated-div'});
25   flushComputedStyle(div);
26   div.style.marginLeft = '200px'; // initiate transition
27
28   var animation = div.getAnimations()[0];
29
30   animation.finish();
31
32   animation.finished.then(t.step_func(function() {
33     animation.play();
34     assert_equals(animation.currentTime, 0,
35                   'Replaying a finished transition should reset its ' +
36                   'currentTime');
37     t.done();
38   }));
39 }, 'Test restarting a finished transition');
40
41 async_test(function(t) {
42   var div = addDiv(t, {'class': 'animated-div'});
43   flushComputedStyle(div);
44   div.style.marginLeft = '200px'; // initiate transition
45
46   var animation = div.getAnimations()[0];
47
48   animation.ready.then(function() {
49     animation.playbackRate = -1;
50     return animation.finished;
51   }).then(t.step_func(function() {
52     animation.play();
53     // FIXME: once animation.effect.computedTiming.endTime is available (bug
54     // 1108055) we should use that here.
55     assert_equals(animation.currentTime, ANIM_DELAY_MS + ANIM_DUR_MS,
56                   'Replaying a finished reversed transition should reset ' +
57                   'its currentTime to the end of the effect');
58     t.done();
59   }));
60 }, 'Test restarting a reversed finished transition');
61
62 </script>
63 </body>