Revision control

1
<div id="target" style="width: 100px; height: 100px; background-color: black;"></div>
2
<script src="../resources/js-test.js"></script>
3
<script>
4
5
const element = document.getElementById("target");
6
const timing = { duration: 1000, iterations: Infinity };
7
8
const shouldBecomeEqualAsync = async (actual, expected) => new Promise(resolve => shouldBecomeEqual(actual, expected, resolve));
9
10
(async () => {
11
if (!window.testRunner || !window.internals) {
12
debug("This test should be run in a test runner.");
13
return;
14
}
15
16
testRunner.waitUntilDone();
17
18
// First, start a transform-related animation that can be accelerated.
19
element.animate({ scale: [1, 2] }, timing);
20
await shouldBecomeEqualAsync("internals.acceleratedAnimationsForElement(element).length", "1");
21
22
// Now, start another transform-related animation that cannot be accelerated due to running at
23
// a speed other than 1. This should not only prevent this animation from running accelerated,
24
// but also make the previous animation revert to a non-accelerated state.
25
element.animate({ rotate: ["30deg", "60deg"] }, timing).updatePlaybackRate(0.5);
26
await shouldBecomeEqualAsync("internals.acceleratedAnimationsForElement(element).length", "0");
27
28
testRunner.notifyDone();
29
})();
30
31
</script>