OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <meta charset=utf-8> |
| 3 <title>KeyframeEffect spacing attribute tests</title> |
| 4 <link rel="help" |
| 5 href="https://w3c.github.io/web-animations/#dom-keyframeeffect-spacing"> |
| 6 <script src="/resources/testharness.js"></script> |
| 7 <script src="/resources/testharnessreport.js"></script> |
| 8 <script src="../../testcommon.js"></script> |
| 9 <body> |
| 10 <div id="log"></div> |
| 11 <script> |
| 12 "use strict"; |
| 13 |
| 14 test(function(t) { |
| 15 var anim = createDiv(t).animate(null); |
| 16 assert_throws(new TypeError, function() { |
| 17 anim.effect.spacing = ''; |
| 18 }); |
| 19 }, 'Test throwing TypeError if using empty string'); |
| 20 |
| 21 test(function(t) { |
| 22 var anim = createDiv(t).animate(null); |
| 23 assert_throws(new TypeError, function() { |
| 24 anim.effect.spacing = 'dist'; |
| 25 }); |
| 26 }, 'Test throwing TypeError if not using the correct keyword'); |
| 27 |
| 28 test(function(t) { |
| 29 var anim = createDiv(t).animate(null); |
| 30 anim.effect.spacing = 'paced(A)'; |
| 31 assert_equals(anim.effect.spacing, 'distribute', 'spacing mode'); |
| 32 }, 'Test falling back to distribute spacing if using a unrecognized property'); |
| 33 |
| 34 test(function(t) { |
| 35 var anim = createDiv(t).animate(null); |
| 36 anim.effect.spacing = 'paced(--bg-color)'; |
| 37 assert_equals(anim.effect.spacing, 'distribute', 'spacing mode'); |
| 38 }, 'Test falling back to distribute spacing if using CSS variables'); |
| 39 |
| 40 test(function(t) { |
| 41 var anim = createDiv(t).animate(null); |
| 42 anim.effect.spacing = 'paced(animation-duration)'; |
| 43 assert_equals(anim.effect.spacing, 'distribute', 'spacing mode'); |
| 44 }, 'Test falling back to distribute spacing if using a non-animatable ' + |
| 45 'property'); |
| 46 |
| 47 test(function(t) { |
| 48 var anim = createDiv(t).animate(null); |
| 49 anim.effect.spacing = 'distribute'; |
| 50 assert_equals(anim.effect.spacing, 'distribute', 'spacing mode'); |
| 51 }, 'Test spacing value if setting distribute'); |
| 52 |
| 53 test(function(t) { |
| 54 var anim = createDiv(t).animate(null); |
| 55 anim.effect.spacing = 'paced(transform)'; |
| 56 assert_equals(anim.effect.spacing, 'paced(transform)', 'spacing mode'); |
| 57 }, 'Test spacing value if setting paced'); |
| 58 |
| 59 </script> |
| 60 </body> |
OLD | NEW |