| OLD | NEW |
| (Empty) |
| 1 <!DOCTYPE html> | |
| 2 <script src="../../resources/testharness.js"></script> | |
| 3 <script src="../../resources/testharnessreport.js"></script> | |
| 4 <div id='container'> | |
| 5 <div id='element'></div> | |
| 6 </div> | |
| 7 | |
| 8 <script> | |
| 9 | |
| 10 var container = document.getElementById('container'); | |
| 11 var element = document.getElementById('element'); | |
| 12 | |
| 13 test(function() { | |
| 14 assert_equals(document.timeline.getAnimations().length, 0); | |
| 15 assert_equals(container.getAnimations().length, 0); | |
| 16 assert_equals(element.getAnimations().length, 0); | |
| 17 | |
| 18 var animation = element.animate([], 1000); | |
| 19 assert_equals(document.timeline.getAnimations().length, 1); | |
| 20 assert_equals(document.timeline.getAnimations()[0], animation); | |
| 21 | |
| 22 var animation2 = container.animate([], 1000); | |
| 23 assert_equals(document.timeline.getAnimations().length, 2); | |
| 24 assert_equals(document.timeline.getAnimations()[0], animation); | |
| 25 assert_equals(document.timeline.getAnimations()[1], animation2); | |
| 26 | |
| 27 animation.finish(); | |
| 28 assert_equals(document.timeline.getAnimations().length, 1); | |
| 29 assert_equals(document.timeline.getAnimations()[0], animation2); | |
| 30 | |
| 31 animation2.finish(); | |
| 32 assert_equals(document.timeline.getAnimations().length, 0); | |
| 33 }, 'Timeline getAnimations()'); | |
| 34 | |
| 35 test(function() { | |
| 36 assert_equals(document.timeline.getAnimations().length, 0); | |
| 37 assert_equals(container.getAnimations().length, 0); | |
| 38 assert_equals(element.getAnimations().length, 0); | |
| 39 | |
| 40 var animation = element.animate([], 1000); | |
| 41 assert_equals(document.timeline.getAnimations().length, 1); | |
| 42 assert_equals(document.timeline.getAnimations()[0], animation); | |
| 43 assert_equals(container.getAnimations().length, 0); | |
| 44 assert_equals(element.getAnimations().length, 1); | |
| 45 assert_equals(element.getAnimations()[0], animation); | |
| 46 | |
| 47 var animation2 = container.animate([], 1000); | |
| 48 assert_equals(document.timeline.getAnimations().length, 2); | |
| 49 assert_equals(document.timeline.getAnimations()[0], animation); | |
| 50 assert_equals(document.timeline.getAnimations()[1], animation2); | |
| 51 assert_equals(container.getAnimations().length, 1); | |
| 52 assert_equals(container.getAnimations()[0], animation2); | |
| 53 assert_equals(element.getAnimations().length, 1); | |
| 54 assert_equals(element.getAnimations()[0], animation); | |
| 55 | |
| 56 animation.finish(); | |
| 57 assert_equals(document.timeline.getAnimations().length, 1); | |
| 58 assert_equals(document.timeline.getAnimations()[0], animation2); | |
| 59 assert_equals(container.getAnimations().length, 1); | |
| 60 assert_equals(container.getAnimations()[0], animation2); | |
| 61 assert_equals(element.getAnimations().length, 0); | |
| 62 | |
| 63 animation2.finish(); | |
| 64 assert_equals(document.timeline.getAnimations().length, 0); | |
| 65 assert_equals(container.getAnimations().length, 0); | |
| 66 assert_equals(element.getAnimations().length, 0); | |
| 67 | |
| 68 }, 'Animatable getAnimations()'); | |
| 69 | |
| 70 test(function() { | |
| 71 assert_equals(document.timeline.getAnimations().length, 0); | |
| 72 assert_equals(container.getAnimations().length, 0); | |
| 73 assert_equals(element.getAnimations().length, 0); | |
| 74 | |
| 75 var animation = element.animate([], {duration: 1000, delay: 500}); | |
| 76 assert_equals(document.timeline.getAnimations().length, 1); | |
| 77 assert_equals(document.timeline.getAnimations()[0], animation); | |
| 78 assert_equals(container.getAnimations().length, 0); | |
| 79 assert_equals(element.getAnimations().length, 1); | |
| 80 assert_equals(element.getAnimations()[0], animation); | |
| 81 | |
| 82 animation.finish(); | |
| 83 assert_equals(document.timeline.getAnimations().length, 0); | |
| 84 assert_equals(container.getAnimations().length, 0); | |
| 85 assert_equals(element.getAnimations().length, 0); | |
| 86 | |
| 87 }, 'getAnimations() with delays'); | |
| 88 | |
| 89 test(function() { | |
| 90 assert_equals(document.timeline.getAnimations().length, 0); | |
| 91 assert_equals(container.getAnimations().length, 0); | |
| 92 assert_equals(element.getAnimations().length, 0); | |
| 93 | |
| 94 var animation = element.animate([], {duration: 1000, delay: 500, fill: 'both
'}); | |
| 95 assert_equals(document.timeline.getAnimations().length, 1); | |
| 96 assert_equals(document.timeline.getAnimations()[0], animation); | |
| 97 assert_equals(container.getAnimations().length, 0); | |
| 98 assert_equals(element.getAnimations().length, 1); | |
| 99 assert_equals(element.getAnimations()[0], animation); | |
| 100 | |
| 101 animation.finish(); | |
| 102 assert_equals(document.timeline.getAnimations().length, 1); | |
| 103 // assert_equals(container.getAnimations().length, 1); | |
| 104 // assert_equals(element.getAnimations().length, 1); | |
| 105 | |
| 106 }, 'getAnimations() - in effect animations'); | |
| 107 | |
| 108 </script> | |
| OLD | NEW |