OLD | NEW |
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" | 1 <!DOCTYPE html> |
2 "http://www.w3.org/TR/html4/loose.dtd"> | 2 <html> |
3 | |
4 <html lang="en"> | |
5 <head> | 3 <head> |
6 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | 4 <meta charset="utf-8"> |
| 5 <script src="../resources/testharness.js"></script> |
| 6 <script src="../resources/testharnessreport.js"></script> |
7 <title>Transition/Animation Test #2</title> | 7 <title>Transition/Animation Test #2</title> |
8 <style type="text/css" media="screen"> | 8 <style> |
9 #box { | 9 #box { |
10 position: absolute; | 10 position: absolute; |
11 left: 0; | 11 left: 0; |
12 top: 100px; | 12 top: 100px; |
13 height: 100px; | 13 height: 100px; |
14 width: 100px; | 14 width: 100px; |
15 background-color: blue; | 15 background-color: blue; |
16 animation-duration: 0.3s; | |
17 animation-timing-function: linear; | |
18 animation-name: anim; | |
19 transition-property: transform; | 16 transition-property: transform; |
20 transition-duration: 10s; | 17 transition-duration: 10s; |
21 transition-timing-function: linear; | 18 transition-timing-function: linear; |
22 } | 19 } |
| 20 #box.running { |
| 21 animation-duration: 0.3s; |
| 22 animation-timing-function: linear; |
| 23 animation-name: anim; |
| 24 } |
23 @keyframes anim { | 25 @keyframes anim { |
24 from { transform: translate(0,100px) } | 26 from { transform: translate(0, 100px); } |
25 to { transform: translate(400px, 100px) } | 27 to { transform: translate(400px, 100px); } |
26 } | 28 } |
27 </style> | 29 </style> |
28 <script src="resources/animation-test-helpers.js" type="text/javascript" cha
rset="utf-8"></script> | |
29 <script type="text/javascript" charset="utf-8"> | |
30 | |
31 const expectedValues = [ | |
32 // [time, element-id, property, expected-value, tolerance] | |
33 [0.4, "box", "transform", "none", 0], | |
34 ]; | |
35 | |
36 // FIXME: This doesn't get called so we don't trigger a transition... | |
37 function setup() | |
38 { | |
39 document.getElementById("box").style.transform = "translateX(400px)"; | |
40 } | |
41 | |
42 runAnimationTest(expectedValues, undefined, undefined, 'do-not-use-pause-api
'); | |
43 | |
44 </script> | |
45 </head> | 30 </head> |
46 <body> | 31 <body> |
47 This test has a transition and animation on the same property (transform). | 32 <div id="box"></div> |
48 The animation starts and then the transition is triggered. The transition should
start | 33 <script> |
49 at the position before the animation started (the unanimated position), which is
(0,0). If it | 34 'use strict'; |
50 starts from the start point of the animation (0,100) then there is an error | 35 async_test(t => { |
51 <div id="box"> | 36 |
52 </div> | 37 t.step(() => { |
53 <div id="result"> | 38 box.offsetTop; // force style recalc |
54 </div> | 39 |
| 40 // Start animation |
| 41 box.classList.add('running'); |
| 42 // No transition - we jump to the animation's initial frame. |
| 43 assert_equals(getComputedStyle(box).transform, 'matrix(1, 0, 0, 1, 0, 10
0)'); |
| 44 |
| 45 // This would trigger a transition if no animation was in progress. |
| 46 box.style.transform = 'translate(400px, 0)'; |
| 47 |
| 48 // We remain at the animation's initial frame. |
| 49 assert_equals(getComputedStyle(box).transform, 'matrix(1, 0, 0, 1, 0, 10
0)'); |
| 50 }); |
| 51 |
| 52 box.addEventListener('animationend', t.step_func_done(() => { |
| 53 // No transition - the inline style takes immediate effect. |
| 54 assert_equals(getComputedStyle(box).transform, 'matrix(1, 0, 0, 1, 400,
0)'); |
| 55 })); |
| 56 }, 'Inline style applies when animation completes'); |
| 57 </script> |
55 </body> | 58 </body> |
56 </html> | 59 </html> |
OLD | NEW |