| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <script src="../../../resources/testharness.js"></script> | 2 <script src="../../../resources/testharness.js"></script> |
| 3 <script src="../../../resources/testharnessreport.js"></script> | 3 <script src="../../../resources/testharnessreport.js"></script> |
| 4 <div id='element'></div> | 4 <div id="element">x</div> |
| 5 <style> | 5 <style> |
| 6 #element { | 6 #element { |
| 7 transition: transform 2000ms; | 7 transition: transform 2000ms; |
| 8 transition-timing-function: linear; | 8 transition-timing-function: linear; |
| 9 } | 9 } |
| 10 </style> | 10 </style> |
| 11 <script> | 11 <script> |
| 12 promise_test(function(t) { | 12 promise_test(function(t) { |
| 13 element.offsetTop; // Force recalc | 13 element.offsetTop; // Force recalc |
| 14 element.style.transform = "rotateX(180deg)"; | 14 element.style.transform = "rotateX(180deg)"; |
| 15 element.offsetTop; // Force recalc | 15 element.offsetTop; // Force recalc |
| 16 | 16 |
| 17 assert_equals(element.getAnimations().length, 1, 'Transition creates an anim
ation'); | 17 assert_equals(element.getAnimations().length, 1, 'Transition creates an anim
ation'); |
| 18 var animation = element.getAnimations()[0]; | 18 var animation = element.getAnimations()[0]; |
| 19 | 19 |
| 20 return animation.ready.then(function() { | 20 return animation.ready.then(function() { |
| 21 assert_equals(element.getAnimations().length, 1, 'No new animations yet'
); | 21 assert_equals(element.getAnimations().length, 1, 'No new animations yet'
); |
| 22 assert_equals(element.getAnimations()[0], animation); | 22 assert_equals(element.getAnimations()[0], animation); |
| 23 | 23 |
| 24 element.style.transform = "rotateX(360deg)"; | 24 element.style.transform = "rotateX(360deg)"; |
| 25 element.offsetTop; // Force recalc | 25 element.offsetTop; // Force recalc |
| 26 | 26 |
| 27 assert_equals(element.getAnimations().length, 1, 'Retargeting transition
results in only one animation'); | 27 assert_equals(element.getAnimations().length, 1, 'Retargeting transition
results in only one animation'); |
| 28 | 28 |
| 29 var newAnimation = element.getAnimations()[0]; | 29 var newAnimation = element.getAnimations()[0]; |
| 30 assert_not_equals(newAnimation, animation); | 30 assert_not_equals(newAnimation, animation); |
| 31 }); | 31 }); |
| 32 }, 'Retargeting a transition should cause the old transition to be cancelled'); | 32 }, 'Retargeting a transition should cause the old transition to be cancelled'); |
| 33 </script> | 33 </script> |
| OLD | NEW |