| OLD | NEW |
| 1 <html lang="en"> | 1 <!DOCTYPE html> |
| 2 <head> | 2 <title>Test of animation-direction</title> |
| 3 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | 3 <script src="../resources/testharness.js"></script> |
| 4 <title>Test of animation-direction</title> | 4 <script src="../resources/testharnessreport.js"></script> |
| 5 <style type="text/css" media="screen"> | 5 <style> |
| 6 body { | 6 #target { |
| 7 animation-direction: normal; |
| 8 animation-duration: 2s; |
| 9 animation-iteration-count: 2; |
| 10 animation-name: move1; |
| 11 animation-play-state: paused; |
| 12 animation-timing-function: linear; |
| 13 background-color: red; |
| 14 height: 100px; |
| 15 left: 0px; |
| 7 margin: 0; | 16 margin: 0; |
| 17 position: absolute; |
| 18 top: 100px; |
| 19 width: 100px; |
| 20 } |
| 21 @keyframes move1 { |
| 22 from { left: 0px; } |
| 23 to { left: 200px; } |
| 8 } | 24 } |
| 9 | 25 |
| 10 #box { | 26 </style> |
| 11 position: absolute; | 27 <div id="target"></div> |
| 12 left: 0px; | 28 <script> |
| 13 top: 100px; | 29 test(function() { |
| 14 height: 100px; | 30 target.style.animationDelay = '-0.5s'; |
| 15 width: 100px; | 31 assert_equals(getComputedStyle(target).left, '50px'); |
| 16 background-color: red; | |
| 17 margin: 0; | |
| 18 animation-duration: 2s; | |
| 19 animation-direction: normal; | |
| 20 animation-iteration-count: 2; | |
| 21 animation-timing-function: linear; | |
| 22 animation-name: move1; | |
| 23 } | |
| 24 #safezone { | |
| 25 position: absolute; | |
| 26 top: 100px; | |
| 27 height: 100px; | |
| 28 width: 130px; | |
| 29 left: 30px; | |
| 30 background-color: green; | |
| 31 } | |
| 32 @keyframes move1 { | |
| 33 from { transform: translateX(0px); } | |
| 34 to { transform: translateX(200px); } | |
| 35 } | |
| 36 </style> | |
| 37 <script src="resources/animation-test-helpers.js" type="text/javascript" chars
et="utf-8"></script> | |
| 38 <script type="text/javascript" charset="utf-8"> | |
| 39 const expectedValues = [ | |
| 40 // [time, element-id, property, expected-value, tolerance] | |
| 41 [0.5, "box", "transform", [1,0,0,1, 50,0], 20], | |
| 42 [1.0, "box", "transform", [1,0,0,1,100,0], 20], | |
| 43 [2.5, "box", "transform", [1,0,0,1, 50,0], 20], | |
| 44 ]; | |
| 45 | 32 |
| 46 function pauseAnimation() | 33 target.style.animationDelay = '-1s'; |
| 47 { | 34 assert_equals(getComputedStyle(target).left, '100px'); |
| 48 document.getElementById("box").style.animationPlayState = "paused"; | |
| 49 } | |
| 50 | 35 |
| 51 function setTimers() | 36 target.style.animationDelay = '-2.5s'; |
| 52 { | 37 assert_equals(getComputedStyle(target).left, '50px'); |
| 53 setTimeout(pauseAnimation, 2500); | 38 }, "animation-direction normal plays forwards"); |
| 54 } | 39 </script> |
| 55 | |
| 56 runAnimationTest(expectedValues, setTimers, null, true, true); | |
| 57 | |
| 58 </script> | |
| 59 </head> | |
| 60 <body> | |
| 61 <!-- This tests the operation of animation-direction. After 1 second the red box
es should be hidden by the green boxes. You should see no red boxes. --> | |
| 62 <div id="box"></div> | |
| 63 <div id="safezone"></div> | |
| 64 <div id="result"></div> | |
| 65 </div> | |
| 66 </body> | |
| 67 </html> | |
| OLD | NEW |