mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Update web-platform-tests to revision 1cb9daef513ee0c7e82a6689a6248946d0c580c0
This commit is contained in:
parent
b9404fcd48
commit
f397fef6e3
159 changed files with 2043 additions and 673 deletions
|
@ -96,18 +96,21 @@ retarget_test("A transition with replaced keyframes animating nothing " +
|
|||
|
||||
test(t => {
|
||||
const div = addDiv(t);
|
||||
// initial conditions
|
||||
|
||||
// Initialize the style.
|
||||
div.style.left = '100px';
|
||||
div.style.top = '100px';
|
||||
div.style.transition = 'left 100s linear, top 100s linear';
|
||||
getComputedStyle(div).left;
|
||||
|
||||
// start some transitions
|
||||
// Start some transitions.
|
||||
div.style.left ='200px';
|
||||
div.style.top = '200px';
|
||||
const transitions = div.getAnimations();
|
||||
|
||||
// hand control of the left property over to top's transition
|
||||
// Hand control of the left property over to top's transition. The composite
|
||||
// ordering of the animations is 'left' then 'top' since the transitions were
|
||||
// generated in the same transition generation and follow Unicode ordering.
|
||||
assert_equals(transitions[0].transitionProperty, 'left');
|
||||
transitions[0].effect.setKeyframes({});
|
||||
transitions[1].effect.setKeyframes([
|
||||
|
@ -115,26 +118,60 @@ test(t => {
|
|||
{left: '400px', top: '200px'}])
|
||||
getComputedStyle(div).left;
|
||||
|
||||
// these form a single style change, equivalent to setting times and then setting left
|
||||
// These updates form a single style change, equivalent to setting times and
|
||||
// then setting left.
|
||||
transitions[0].currentTime = 50 * MS_PER_SEC;
|
||||
div.style.left ='100px';
|
||||
transitions[1].currentTime = 60 * MS_PER_SEC;
|
||||
|
||||
const reversedTransition = div.getAnimations()[1]
|
||||
// As there was a style change event, the new 'left' transition now has a
|
||||
// higher value for the transition generation than the 'top' transition,
|
||||
// reversing the order of the transitions returned by getAnimations.
|
||||
const reversedTransition = div.getAnimations()[1];
|
||||
assert_equals(reversedTransition.transitionProperty, 'left',
|
||||
"A reversed transition on left is produced");
|
||||
|
||||
assert_approx_equals(
|
||||
reversedTransition.effect.getComputedTiming().activeDuration,
|
||||
50 * MS_PER_SEC, 1,
|
||||
"The reversed transition has correctly reduced duration (based on the original left transition)."
|
||||
);
|
||||
"The reversed transition has correctly reduced duration (based on the " +
|
||||
"original left transition).");
|
||||
|
||||
assert_equals(reversedTransition.effect.getKeyframes()[0].left, '280px',
|
||||
"The reversed transition gets its start value from the other transition controlling left");
|
||||
"The reversed transition gets its start value from the other " +
|
||||
"transition controlling left");
|
||||
|
||||
}, "A transition with replaced keyframes animating nothing on a property being controlled by another " +
|
||||
"modified transition exhibits normal reversing behavior and reverses from the other " +
|
||||
"transition's current value.");
|
||||
}, "A transition with replaced keyframes animating nothing on a property " +
|
||||
"being controlled by another modified transition exhibits normal " +
|
||||
"reversing behavior and reverses from the other transition's current " +
|
||||
"value.");
|
||||
|
||||
test(t => {
|
||||
const div = addDiv(t);
|
||||
|
||||
// Initialize the style.
|
||||
div.style.left = '100px';
|
||||
div.style.transition = 'left 100s linear';
|
||||
getComputedStyle(div).left;
|
||||
|
||||
// Start the transtion.
|
||||
div.style.left ='200px';
|
||||
const transition = div.getAnimations()[0];
|
||||
|
||||
// Update the keyframes and advance to the midpoint of the animation.
|
||||
transition.effect.setKeyframes([
|
||||
{ offset: 0, left: '-50px', composite: 'add', easing: 'linear'}]);
|
||||
transition.currentTime = 50 * MS_PER_SEC;
|
||||
assert_equals(getComputedStyle(div).left, '175px',
|
||||
'The computed style is based on the updated keyframes');
|
||||
|
||||
div.style.left = '100px';
|
||||
const reversedTransition = div.getAnimations()[0];
|
||||
assert_equals(reversedTransition.effect.getKeyframes()[0].left, '175px',
|
||||
'The start value matches the \'before change\' value');
|
||||
|
||||
}, 'A transition with replaced kefyrames and composite \'add\' exhibits ' +
|
||||
'normal reversing behavior, and the effect is not double counted when ' +
|
||||
'calculating the before change style');
|
||||
|
||||
</script>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue