| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <meta charset=utf-8> | 2 <meta charset=utf-8> |
| 3 <title>Setting the start time tests</title> | 3 <title>Setting the start time tests</title> |
| 4 <link rel="help" href="https://w3c.github.io/web-animations/#set-the-animation-s
tart-time"> | 4 <link rel="help" href="https://w3c.github.io/web-animations/#set-the-animation-s
tart-time"> |
| 5 <script src="/resources/testharness.js"></script> | 5 <script src="/resources/testharness.js"></script> |
| 6 <script src="/resources/testharnessreport.js"></script> | 6 <script src="/resources/testharnessreport.js"></script> |
| 7 <script src="../../testcommon.js"></script> | 7 <script src="../../testcommon.js"></script> |
| 8 <body> | 8 <body> |
| 9 <div id="log"></div> | 9 <div id="log"></div> |
| 10 <script> | 10 <script> |
| 11 'use strict'; | 11 'use strict'; |
| 12 | 12 |
| 13 test(function(t) | 13 test(function(t) |
| 14 { | 14 { |
| 15 // It should only be possible to set *either* the start time or the current | 15 // It should only be possible to set *either* the start time or the current |
| 16 // time for an animation that does not have an active timeline. | 16 // time for an animation that does not have an active timeline. |
| 17 | 17 |
| 18 var animation = | 18 var animation = |
| 19 new Animation(new KeyframeEffect(createDiv(t), null, 100 * MS_PER_SEC)); | 19 new Animation(new KeyframeEffect(createDiv(t), null, 100 * MS_PER_SEC), |
| 20 null); |
| 20 | 21 |
| 21 assert_equals(animation.currentTime, null, 'Intial current time'); | 22 assert_equals(animation.currentTime, null, 'Intial current time'); |
| 22 assert_equals(animation.startTuime, null, 'Intial start time'); | 23 assert_equals(animation.startTime, null, 'Intial start time'); |
| 23 | 24 |
| 24 animation.currentTime = 1000; | 25 animation.currentTime = 1000; |
| 25 assert_equals(animation.currentTime, 1000, | 26 assert_equals(animation.currentTime, 1000, |
| 26 'Setting the current time succeeds'); | 27 'Setting the current time succeeds'); |
| 27 assert_equals(animation.startTime, null, | 28 assert_equals(animation.startTime, null, |
| 28 'Start time remains null after setting current time'); | 29 'Start time remains null after setting current time'); |
| 29 | 30 |
| 30 animation.startTime = 1000; | 31 animation.startTime = 1000; |
| 31 assert_equals(animation.startTime, 1000, | 32 assert_equals(animation.startTime, 1000, |
| 32 'Setting the start time succeeds'); | 33 'Setting the start time succeeds'); |
| 33 assert_equals(animation.currentTime, null, | 34 assert_equals(animation.currentTime, null, |
| 34 'Setting the start time clears the current time'); | 35 'Setting the start time clears the current time'); |
| 35 | 36 |
| 36 animation.startTime = null; | 37 animation.startTime = null; |
| 37 assert_equals(animation.startTime, null, | 38 assert_equals(animation.startTime, null, |
| 38 'Setting the start time to an unresolved time succeeds'); | 39 'Setting the start time to an unresolved time succeeds'); |
| 39 assert_equals(animation.currentTime, null, 'The current time is unaffected'); | 40 assert_equals(animation.currentTime, null, 'The current time is unaffected'); |
| 40 | 41 |
| 41 }, 'Setting the start time of an animation without an active timeline'); | 42 }, 'Setting the start time of an animation without an active timeline'); |
| 42 | 43 |
| 43 test(function(t) | 44 test(function(t) |
| 44 { | 45 { |
| 45 // Setting an unresolved start time on an animation without an active | 46 // Setting an unresolved start time on an animation without an active |
| 46 // timeline should not clear the current time. | 47 // timeline should not clear the current time. |
| 47 | 48 |
| 48 var animation = | 49 var animation = |
| 49 new Animation(new KeyframeEffect(createDiv(t), null, 100 * MS_PER_SEC)); | 50 new Animation(new KeyframeEffect(createDiv(t), null, 100 * MS_PER_SEC), |
| 51 null); |
| 50 | 52 |
| 51 assert_equals(animation.currentTime, null, 'Intial current time'); | 53 assert_equals(animation.currentTime, null, 'Intial current time'); |
| 52 assert_equals(animation.startTuime, null, 'Intial start time'); | 54 assert_equals(animation.startTime, null, 'Intial start time'); |
| 53 | 55 |
| 54 animation.currentTime = 1000; | 56 animation.currentTime = 1000; |
| 55 assert_equals(animation.currentTime, 1000, | 57 assert_equals(animation.currentTime, 1000, |
| 56 'Setting the current time succeeds'); | 58 'Setting the current time succeeds'); |
| 57 assert_equals(animation.startTime, null, | 59 assert_equals(animation.startTime, null, |
| 58 'Start time remains null after setting current time'); | 60 'Start time remains null after setting current time'); |
| 59 | 61 |
| 60 animation.startTime = null; | 62 animation.startTime = null; |
| 61 assert_equals(animation.startTime, null, 'Start time remains unresolved'); | 63 assert_equals(animation.startTime, null, 'Start time remains unresolved'); |
| 62 assert_equals(animation.currentTime, 1000, 'Current time is unaffected'); | 64 assert_equals(animation.currentTime, 1000, 'Current time is unaffected'); |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 var finishedCurrentTime = animation.currentTime; | 198 var finishedCurrentTime = animation.currentTime; |
| 197 return waitForAnimationFrames(1).then(function() { | 199 return waitForAnimationFrames(1).then(function() { |
| 198 assert_equals(animation.currentTime, finishedCurrentTime, | 200 assert_equals(animation.currentTime, finishedCurrentTime, |
| 199 'Current time does not change after seeking past the effect' | 201 'Current time does not change after seeking past the effect' |
| 200 + ' end time by setting the current time'); | 202 + ' end time by setting the current time'); |
| 201 }); | 203 }); |
| 202 }, 'Setting the start time updates the finished state'); | 204 }, 'Setting the start time updates the finished state'); |
| 203 | 205 |
| 204 </script> | 206 </script> |
| 205 </body> | 207 </body> |
| OLD | NEW |