mirror of
https://github.com/servo/servo.git
synced 2025-08-15 18:35:33 +01:00
Update web-platform-tests to revision 6aef6676d2f95c29de17666cc70d61b517939fbf
This commit is contained in:
parent
cd0e7e7ebb
commit
3ebfea9f10
250 changed files with 2846 additions and 702 deletions
|
@ -0,0 +1,116 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<title>CSSTransition.startTime</title>
|
||||
<!-- TODO: Add a more specific link for this once it is specified. -->
|
||||
<link rel="help" href="https://drafts.csswg.org/css-transitions-2/#csstransition">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="support/helper.js"></script>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
|
||||
'use strict';
|
||||
|
||||
test(t => {
|
||||
const div = addDiv(t, {
|
||||
style: 'margin-left: 100px; transition: margin-left 100s linear 100s',
|
||||
});
|
||||
getComputedStyle(div).marginLeft;
|
||||
div.style.marginLeft = '200px';
|
||||
const animation = div.getAnimations()[0];
|
||||
|
||||
assert_equals(animation.startTime, null, 'startTime is unresolved');
|
||||
}, 'The start time of a newly-created transition is unresolved');
|
||||
|
||||
promise_test(async t => {
|
||||
const div = addDiv(t);
|
||||
|
||||
div.style.left = '0px';
|
||||
div.style.top = '0px';
|
||||
getComputedStyle(div).transitionProperty;
|
||||
|
||||
div.style.transition = 'all 100s';
|
||||
div.style.left = '100px';
|
||||
div.style.top = '100px';
|
||||
|
||||
let animations = div.getAnimations();
|
||||
assert_equals(animations.length, 2);
|
||||
await waitForAllAnimations(animations);
|
||||
|
||||
assert_equals(animations[0].startTime, animations[1].startTime,
|
||||
'CSS transitions started together have the same start time');
|
||||
|
||||
await waitForFrame();
|
||||
|
||||
div.style.backgroundColor = 'green';
|
||||
|
||||
animations = div.getAnimations();
|
||||
assert_equals(animations.length, 3);
|
||||
await waitForAllAnimations(animations);
|
||||
|
||||
assert_less_than(animations[1].startTime, animations[2].startTime,
|
||||
'A CSS transition added in a later frame has a later start time');
|
||||
}, 'The start time of transitions is based on when they are generated');
|
||||
|
||||
test(t => {
|
||||
const div = addDiv(t, {
|
||||
style: 'margin-left: 100px; transition: margin-left 100s linear 100s',
|
||||
});
|
||||
getComputedStyle(div).marginLeft;
|
||||
div.style.marginLeft = '200px';
|
||||
const animation = div.getAnimations()[0];
|
||||
|
||||
const timelineTime = animation.timeline.currentTime;
|
||||
animation.startTime = timelineTime;
|
||||
|
||||
assert_times_equal(
|
||||
animation.startTime,
|
||||
timelineTime,
|
||||
'Check setting of startTime actually works'
|
||||
);
|
||||
}, 'The start time of a transition can be set');
|
||||
|
||||
promise_test(async t => {
|
||||
const div = addDiv(t, {
|
||||
style: 'margin-left: 100px; transition: margin-left 100s linear 100s',
|
||||
});
|
||||
getComputedStyle(div).marginLeft;
|
||||
div.style.marginLeft = '200px';
|
||||
const animation = div.getAnimations()[0];
|
||||
|
||||
await animation.ready;
|
||||
|
||||
const timelineTime = animation.timeline.currentTime;
|
||||
const marginLeft = () => parseFloat(getComputedStyle(div).marginLeft);
|
||||
|
||||
animation.startTime = timelineTime - 100 * MS_PER_SEC;
|
||||
assert_equals(marginLeft(), 100);
|
||||
|
||||
animation.startTime = timelineTime - 150 * MS_PER_SEC;
|
||||
assert_equals(marginLeft(), 150);
|
||||
}, 'The start time can be set to seek a transition');
|
||||
|
||||
promise_test(async t => {
|
||||
const div = addDiv(t, {
|
||||
style: 'margin-left: 100px; transition: margin-left 100s linear 100s',
|
||||
});
|
||||
const eventWatcher = new EventWatcher(t, div, [
|
||||
'transitionstart',
|
||||
'transitionend',
|
||||
]);
|
||||
getComputedStyle(div).marginLeft;
|
||||
div.style.marginLeft = '200px';
|
||||
const animation = div.getAnimations()[0];
|
||||
|
||||
await animation.ready;
|
||||
|
||||
const timelineTime = animation.timeline.currentTime;
|
||||
|
||||
animation.startTime = timelineTime - 100 * MS_PER_SEC;
|
||||
await eventWatcher.wait_for('transitionstart');
|
||||
|
||||
animation.startTime = timelineTime - 200 * MS_PER_SEC;
|
||||
await eventWatcher.wait_for('transitionend');
|
||||
}, 'Seeking a transition using start time dispatches transition events');
|
||||
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue