Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <meta charset=utf-8> | |
| 3 <title>Test combinations of delay and endDelay</title> | |
| 4 <link rel="help" href="https://w3c.github.io/web-animations/#the-animationeffect timing-interface"> | |
| 2 <script src="../resources/testharness.js"></script> | 5 <script src="../resources/testharness.js"></script> |
| 3 <script src="../resources/testharnessreport.js"></script> | 6 <script src="../resources/testharnessreport.js"></script> |
| 7 <script src="../imported/wpt/web-animations/testcommon.js"></script> | |
| 4 <div id="container"></div> | 8 <div id="container"></div> |
|
alancutter (OOO until 2018)
2016/07/12 03:32:30
No need for container any more, createDiv() append
nainar
2016/07/12 03:56:57
Replaced with body cause you do need a container f
| |
| 5 <script> | 9 <script> |
| 6 function testTiming({timing, expectations}, description) { | 10 function testTiming({timing, expectations}, description) { |
| 7 test(() => { | 11 test((t) => { |
|
alancutter (OOO until 2018)
2016/07/12 03:31:53
No need for brackets around t.
nainar
2016/07/12 03:56:57
Done.
| |
| 8 for (let {at, expect} of expectations) { | 12 for (let {at, expect} of expectations) { |
| 9 let target = document.createElement('div'); | 13 let target = createDiv(t); |
| 10 container.appendChild(target); | 14 container.appendChild(target); |
| 11 let animation = target.animate({opacity: [0, 1]}, timing); | 15 let animation = target.animate({opacity: [0, 1]}, timing); |
| 12 animation.currentTime = at; | 16 animation.currentTime = at; |
| 13 assert_equals(Number(getComputedStyle(target).opacity), expect, 'at ' + at ); | 17 assert_times_equal(Number(getComputedStyle(target).opacity), expect, 'at ' + at); |
| 14 animation.cancel(); | 18 animation.cancel(); |
| 15 } | 19 } |
| 16 }, description); | 20 }, description); |
| 17 } | 21 } |
| 18 | 22 |
| 19 testTiming({ | 23 testTiming({ |
| 20 timing: { | 24 timing: { |
| 21 duration: 10, | 25 duration: 10, |
| 22 delay: 1, | 26 delay: 1, |
| 23 endDelay: 1, | 27 endDelay: 1, |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 98 { at: -2, expect: 0 }, | 102 { at: -2, expect: 0 }, |
| 99 { at: -1, expect: 1 }, | 103 { at: -1, expect: 1 }, |
| 100 { at: 0, expect: 1 }, | 104 { at: 0, expect: 1 }, |
| 101 { at: 5, expect: 1 }, | 105 { at: 5, expect: 1 }, |
| 102 { at: 10, expect: 1 }, | 106 { at: 10, expect: 1 }, |
| 103 { at: 11, expect: 1 }, | 107 { at: 11, expect: 1 }, |
| 104 { at: 12, expect: 1 }, | 108 { at: 12, expect: 1 }, |
| 105 ], | 109 ], |
| 106 }, 'Negative endDelay that eclipses delay and duration'); | 110 }, 'Negative endDelay that eclipses delay and duration'); |
| 107 </script> | 111 </script> |
| OLD | NEW |