OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <meta charset=utf-8> |
| 3 <title>delay tests</title> |
| 4 <link rel="help" href="https://w3c.github.io/web-animations/#dom-animationeffect
timing-delay"> |
| 5 <link rel="author" title="Daisuke Akatsuka" href="mailto:daisuke@mozilla-japan.o
rg"> |
| 6 <script src="../../../../resources/testharness.js"></script> |
| 7 <script src="../../../../resources/testharnessreport.js"></script> |
| 8 <script src="../testcommon.js"></script> |
| 9 <link rel="stylesheet" href="../../../../resources/testharness.css"> |
| 10 <body> |
| 11 <div id="log"></div> |
| 12 <script> |
| 13 'use strict'; |
| 14 |
| 15 test(function(t) { |
| 16 var div = createDiv(t); |
| 17 var anim = div.animate({ opacity: [ 0, 1 ] }, 100); |
| 18 anim.effect.timing.delay = 100; |
| 19 assert_equals(anim.effect.timing.delay, 100, 'set delay 100'); |
| 20 assert_equals(anim.effect.getComputedTiming().delay, 100, |
| 21 'getComputedTiming() after set delay 100'); |
| 22 }, 'set delay 100'); |
| 23 |
| 24 test(function(t) { |
| 25 var div = createDiv(t); |
| 26 var anim = div.animate({ opacity: [ 0, 1 ] }, 100); |
| 27 anim.effect.timing.delay = -100; |
| 28 assert_equals(anim.effect.timing.delay, -100, 'set delay -100'); |
| 29 assert_equals(anim.effect.getComputedTiming().delay, -100, |
| 30 'getComputedTiming() after set delay -100'); |
| 31 }, 'set delay -100'); |
| 32 |
| 33 test(function(t) { |
| 34 var div = createDiv(t); |
| 35 var anim = div.animate({ opacity: [ 0, 1 ] }, 100); |
| 36 anim.effect.timing.delay = 100; |
| 37 assert_equals(anim.effect.getComputedTiming().progress, null); |
| 38 assert_equals(anim.effect.getComputedTiming().currentIteration, null); |
| 39 }, 'Test adding a positive delay to an animation without a backwards fill ' + |
| 40 'makes it no longer active'); |
| 41 |
| 42 test(function(t) { |
| 43 var div = createDiv(t); |
| 44 var anim = div.animate({ opacity: [ 0, 1 ] }, |
| 45 { fill: 'both', |
| 46 duration: 100 }); |
| 47 anim.effect.timing.delay = -50; |
| 48 assert_equals(anim.effect.getComputedTiming().progress, 0.5); |
| 49 }, 'Test seeking an animation by setting a negative delay'); |
| 50 |
| 51 test(function(t) { |
| 52 var div = createDiv(t); |
| 53 var anim = div.animate({ opacity: [ 0, 1 ] }, |
| 54 { fill: 'both', |
| 55 duration: 100 }); |
| 56 anim.effect.timing.delay = -100; |
| 57 assert_equals(anim.effect.getComputedTiming().progress, 1); |
| 58 assert_equals(anim.effect.getComputedTiming().currentIteration, 0); |
| 59 }, 'Test finishing an animation using a large negative delay'); |
| 60 |
| 61 </script> |
| 62 </body> |
OLD | NEW |