OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <meta charset=utf-8> |
| 3 <title>Animatable.getAnimations tests</title> |
| 4 <link rel="help" href="https://w3c.github.io/web-animations/#dom-animatable-geta
nimations"> |
| 5 <script src="/resources/testharness.js"></script> |
| 6 <script src="/resources/testharnessreport.js"></script> |
| 7 <script src="../../testcommon.js"></script> |
| 8 <body> |
| 9 <script> |
| 10 'use strict'; |
| 11 |
| 12 test(function(t) { |
| 13 var div = createDiv(t); |
| 14 assert_array_equals(div.getAnimations(), []); |
| 15 }, 'Test getAnimations on element with no animations'); |
| 16 |
| 17 test(function(t) { |
| 18 var div = createDiv(t); |
| 19 var animationA = div.animate(null, 100 * MS_PER_SEC); |
| 20 var animationB = div.animate(null, 100 * MS_PER_SEC); |
| 21 assert_array_equals(div.getAnimations(), [animationA, animationB]); |
| 22 }, 'Test getAnimations on element with two animations'); |
| 23 |
| 24 test(function(t) { |
| 25 var divA = createDiv(t); |
| 26 var divB = createDiv(t); |
| 27 var animationA = divA.animate(null, 100 * MS_PER_SEC); |
| 28 var animationB = divB.animate(null, 100 * MS_PER_SEC); |
| 29 assert_array_equals(divA.getAnimations(), [animationA], 'divA'); |
| 30 assert_array_equals(divB.getAnimations(), [animationB], 'divB'); |
| 31 }, 'Test getAnimations on separate elements with separate animations'); |
| 32 |
| 33 test(function(t) { |
| 34 var divParent = createDiv(t); |
| 35 var divChild = createDiv(t); |
| 36 divParent.appendChild(divChild); |
| 37 var animationParent = divParent.animate(null, 100 * MS_PER_SEC); |
| 38 var animationChild = divChild.animate(null, 100 * MS_PER_SEC); |
| 39 assert_array_equals(divParent.getAnimations(), [animationParent], 'divParent')
; |
| 40 assert_array_equals(divChild.getAnimations(), [animationChild], 'divChild'); |
| 41 }, 'Test getAnimations on parent and child elements with separate animations'); |
| 42 |
| 43 test(function(t) { |
| 44 var div = createDiv(t); |
| 45 var animation = div.animate(null, 100 * MS_PER_SEC); |
| 46 animation.finish(); |
| 47 assert_array_equals(div.getAnimations(), []); |
| 48 }, 'Test getAnimations on element with finished fill none animation'); |
| 49 |
| 50 test(function(t) { |
| 51 var div = createDiv(t); |
| 52 var animation = div.animate(null, { |
| 53 duration: 100 * MS_PER_SEC, |
| 54 fill: 'forwards', |
| 55 }); |
| 56 animation.finish(); |
| 57 assert_array_equals(div.getAnimations(), [animation]); |
| 58 }, 'Test getAnimations on element with finished fill forwards animation'); |
| 59 |
| 60 test(function(t) { |
| 61 var div = createDiv(t); |
| 62 var animation = div.animate(null, { |
| 63 duration: 100 * MS_PER_SEC, |
| 64 delay: 100 * MS_PER_SEC, |
| 65 }); |
| 66 assert_array_equals(div.getAnimations(), [animation]); |
| 67 }, 'Test getAnimations on element with delayed animation'); |
| 68 |
| 69 </script> |
| 70 </body> |
OLD | NEW |