| <script src="../resources/testharness.js"></script> |
| <script src="../resources/testharnessreport.js"></script> |
| <script src="resources/request-frames-until-true.js"></script> |
| promise_test(async t => { |
| const target = document.getElementById("target"); |
| const acceleratedAnimationsStarted = async numberOfAnimations => { |
| return requestFramesUntilTrue( |
| () => internals.acceleratedAnimationsForElement(target).length == numberOfAnimations, |
| () => !"acceleratedAnimationsForElement" in window.internals); |
| target.style.opacity = "0.5"; |
| target.style.marginLeft = "100px"; |
| await new Promise(setTimeout); |
| // Now update styles to trigger a transition for properties, only one of which should yield an accelerated animation. |
| target.style.removeProperty("opacity"); |
| target.style.removeProperty("margin-left"); |
| target.style.transitionProperty = "margin-left opacity"; |
| target.style.transitionDuration = "1s"; |
| // Wait a few frames for the opacity animation to be commited. |
| await acceleratedAnimationsStarted(1); |
| }, "Transtioning two properties, one of which can be accelerated while the other cannot, yields only one accelerated animation."); |