| <script src="../resources/ui-helper.js"></script> |
| const waitForAnimationCommit = async (animation) => { |
| if (!UIHelper.isWebKit2()) { |
| await UIHelper.renderingUpdate(); |
| await UIHelper.renderingUpdate(); |
| await UIHelper.ensureStablePresentationUpdate() |
| testRunner.waitUntilDone(); |
| const target = document.getElementById("target"); |
| // Make the animations last a whole minute so they don't end while the test is running. |
| const duration = 60 * 1000; |
| // Start a first stationary "transform" animation and wait until it has been applied before starting |
| // a second stationary "transform" animation which should replace the first one. |
| await waitForAnimationCommit(target.animate({ transform: ["translateX(100px)", "translateX(100px)"] }, duration)); |
| await waitForAnimationCommit(target.animate({ transform: ["translateX(200px)", "translateX(200px)"] }, duration)); |