mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-11-11 13:48:23 +02:00
Automatic update from web-platform-tests Implement onremove event for web animations. Spec: https://drafts.csswg.org/web-animations-1/#remove-replaced-animations Intent: https://groups.google.com/a/chromium.org/forum/#!msg/blink-dev/H5sz_dg6fKc/1X7K7U4XCgAJ Bug: 981905 Change-Id: I9267e3e4fda14133f2edcc0e8aea1e8a031959a1 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2020245 Commit-Queue: Kevin Ellis <kevers@chromium.org> Reviewed-by: Robert Flack <flackr@chromium.org> Cr-Commit-Position: refs/heads/master@{#735437} -- wpt-commits: e1ae4ab28c968d45fbd8f4ad1377ce071d244484 wpt-pr: 21418
58 lines
1.8 KiB
HTML
58 lines
1.8 KiB
HTML
<!DOCTYPE html>
|
|
<meta charset=utf-8>
|
|
<title>Animation.onremove</title>
|
|
<link rel="help" href="https://drafts.csswg.org/web-animations/#dom-animation-onremove">
|
|
<script src="/resources/testharness.js"></script>
|
|
<script src="/resources/testharnessreport.js"></script>
|
|
<script src="../../testcommon.js"></script>
|
|
<body>
|
|
<div id="log"></div>
|
|
<script>
|
|
'use strict';
|
|
|
|
async_test(t => {
|
|
const div = createDiv(t);
|
|
const animA = div.animate({ opacity: 1 }, { duration: 1, fill: 'forwards' });
|
|
const animB = div.animate({ opacity: 1 }, { duration: 1, fill: 'forwards' });
|
|
|
|
let finishedTimelineTime = null;
|
|
animB.onfinish = event => {
|
|
finishedTimelineTime = event.timelineTime;
|
|
};
|
|
|
|
animA.onremove = t.step_func_done(event => {
|
|
assert_equals(animA.replaceState, 'removed');
|
|
assert_equals(event.currentTime, 1);
|
|
assert_true(finishedTimelineTime != null, 'finished event fired');
|
|
assert_true(event.timelineTime == finishedTimelineTime,
|
|
'timeline time is set');
|
|
});
|
|
|
|
}, 'onremove event is fired when replaced animation is removed.');
|
|
|
|
promise_test(async t => {
|
|
const div = createDiv(t);
|
|
const animA = div.animate({ opacity: 1 }, { duration: 1, fill: 'forwards' });
|
|
const animB = div.animate({ opacity: 1 }, { duration: 1, fill: 'forwards' });
|
|
const animC = div.animate({ opacity: 1 }, { duration: 1, fill: 'forwards' });
|
|
const animD = div.animate({ opacity: 1 }, { duration: 1, fill: 'forwards' });
|
|
|
|
const removed = [];
|
|
|
|
animA.onremove = () => { removed.push('A'); };
|
|
animB.onremove = () => { removed.push('B'); };
|
|
animC.onremove = () => { removed.push('C'); };
|
|
|
|
animD.onremove = event => {
|
|
assert_unreached('onremove event should not be fired');
|
|
};
|
|
|
|
await waitForAnimationFrames(2);
|
|
|
|
assert_equals(removed.join(''), 'ABC');
|
|
|
|
}, 'onremove events are fired in the correct order');
|
|
|
|
</script>
|
|
</body>
|
|
|