Update web-platform-tests to revision ddf26e73d3f23ef896efc7977d06707e74f46941

This commit is contained in:
WPT Sync Bot 2020-02-29 08:21:32 +00:00
parent 60ee61bb8b
commit 953f6f0527
68 changed files with 1763 additions and 371 deletions

View file

@ -35,94 +35,99 @@ test(t => {
'getAnimations returns no running CSS Transitions');
}, 'getAnimations for CSS Transitions');
test(t => {
// Create two divs with the following arrangement:
//
// parent
// (::marker,)
// ::before,
// ::after
// |
// child
function pseudoTest(description, testMarkerPseudos) {
test(t => {
// Create two divs with the following arrangement:
//
// parent
// (::marker,) // Optionally
// ::before,
// ::after
// |
// child
addStyle(t, {
'.init::after': 'content: ""; width: 0px; transition: all 100s;',
'.init::before': 'content: ""; width: 0px; transition: all 100s;',
'.change::after': 'width: 100px;',
'.change::before': 'width: 100px;',
});
const supportsMarkerPseudos = CSS.supports('selector(::marker)');
if (supportsMarkerPseudos) {
addStyle(t, {
'.init::marker': 'content: ""; color: red; transition: all 100s;',
'.change::marker': 'color: green;',
'.init::after': 'content: ""; width: 0px; transition: all 100s;',
'.init::before': 'content: ""; width: 0px; transition: all 100s;',
'.change::after': 'width: 100px;',
'.change::before': 'width: 100px;',
});
}
const parent = addDiv(t, { 'style': 'display: list-item' });
const child = addDiv(t);
parent.appendChild(child);
parent.style.left = '0px';
parent.style.transition = 'left 100s';
parent.classList.add('init');
child.style.left = '0px';
child.style.transition = 'left 100s';
getComputedStyle(parent).left;
parent.style.left = '100px';
parent.classList.add('change');
child.style.left = '100px';
const expectedTransitions = [
[parent, undefined],
[parent, '::marker'],
[parent, '::before'],
[parent, '::after'],
[child, undefined],
];
if (!supportsMarkerPseudos) {
expectedTransitions.splice(1, 1);
}
const transitions = document.getAnimations();
assert_equals(
transitions.length,
expectedTransitions.length,
'CSS transition on both pseudo-elements and elements are returned'
);
for (const [index, expected] of expectedTransitions.entries()) {
const [element, pseudo] = expected;
const actual = transitions[index];
if (pseudo) {
assert_equals(
actual.effect.target,
element,
`Transition #${index + 1} has expected target`
);
assert_equals(
actual.effect.pseudoElement,
pseudo,
`Transition #${index + 1} has expected pseudo type`
);
} else {
assert_equals(
actual.effect.target,
element,
`Transition #${index + 1} has expected target`
);
assert_equals(
actual.effect.pseudoElement,
null,
`Transition #${index + 1} has null pseudo type`
);
if (testMarkerPseudos) {
addStyle(t, {
'.init::marker': 'content: ""; color: red; transition: all 100s;',
'.change::marker': 'color: green;',
});
}
}
}, 'CSS Transitions targetting (pseudo-)elements should have correct order '
+ 'after sorting');
const parent = addDiv(t, { 'style': 'display: list-item' });
const child = addDiv(t);
parent.appendChild(child);
parent.style.left = '0px';
parent.style.transition = 'left 100s';
parent.classList.add('init');
child.style.left = '0px';
child.style.transition = 'left 100s';
getComputedStyle(parent).left;
parent.style.left = '100px';
parent.classList.add('change');
child.style.left = '100px';
const expectedTransitions = [
[parent, undefined],
[parent, '::marker'],
[parent, '::before'],
[parent, '::after'],
[child, undefined],
];
if (!testMarkerPseudos) {
expectedTransitions.splice(1, 1);
}
const transitions = document.getAnimations();
assert_equals(
transitions.length,
expectedTransitions.length,
'CSS transition on both pseudo-elements and elements are returned'
);
for (const [index, expected] of expectedTransitions.entries()) {
const [element, pseudo] = expected;
const actual = transitions[index];
if (pseudo) {
assert_equals(
actual.effect.target,
element,
`Transition #${index + 1} has expected target`
);
assert_equals(
actual.effect.pseudoElement,
pseudo,
`Transition #${index + 1} has expected pseudo type`
);
} else {
assert_equals(
actual.effect.target,
element,
`Transition #${index + 1} has expected target`
);
assert_equals(
actual.effect.pseudoElement,
null,
`Transition #${index + 1} has null pseudo type`
);
}
}
}, description);
}
pseudoTest('CSS Transitions targetting (pseudo-)elements should have correct '
+ 'order after sorting', false)
pseudoTest('CSS Transitions targetting (pseudo-)elements should have correct '
+ 'order after sorting (::marker)', true)
promise_test(async t => {
const div = addDiv(t, { style: 'left: 0px; transition: all 50ms' });

View file

@ -51,39 +51,6 @@ promise_test(async t => {
}, 'Transitions on ::before/::after pseudo-elements are canceled when the'
+ ' content property is cleared');
promise_test(async t => {
if (!CSS.supports('selector(::marker)')) {
return;
}
addStyle(t, {
'.init::marker': 'content: ""; color: red; transition: color 100s;',
'.change::marker': 'color: green',
});
// Create element (and pseudo-element) and attach event listeners
const div = addDiv(t, { 'style': 'display: list-item' });
div.classList.add('init');
const eventWatcher = new EventWatcher(t, div, [
'transitionrun',
'transitioncancel',
]);
// Trigger transition
getComputedStyle(div).color;
div.classList.add('change');
getComputedStyle(div).color;
await eventWatcher.wait_for('transitionrun');
// Make the parent element no longer display: list-item so that the pseudo
// element no longer renders
div.style.display = 'block';
await eventWatcher.wait_for('transitioncancel');
}, 'Transitions on ::marker pseudo-elements are canceled when the'
+ ' parent display type is no longer list-item');
</script>
</body>

View file

@ -0,0 +1,51 @@
<!doctype html>
<html>
<head>
<meta charset=utf-8>
<title>CSS Transitions Test: Transitions do not run for a ::marker-element that is not being rendered</title>
<link rel="help" title="Starting transitions"
href="https://drafts.csswg.org/css-transitions/#starting">
<script src="/resources/testharness.js" type="text/javascript"></script>
<script src="/resources/testharnessreport.js" type="text/javascript"></script>
<script src="./support/helper.js" type="text/javascript"></script>
</head>
<body>
<div id="log"></div>
<script>
promise_test(async t => {
addStyle(t, {
'.init::marker': 'content: ""; color: red; transition: color 100s;',
'.change::marker': 'color: green',
});
// Create element (and pseudo-element) and attach event listeners
const div = addDiv(t, { 'style': 'display: list-item' });
div.classList.add('init');
const eventWatcher = new EventWatcher(t, div, [
'transitionrun',
'transitioncancel',
]);
// Trigger transition
getComputedStyle(div).color;
div.classList.add('change');
getComputedStyle(div).color;
await eventWatcher.wait_for('transitionrun');
// Make the parent element no longer display: list-item so that the pseudo
// element no longer renders
div.style.display = 'block';
await eventWatcher.wait_for('transitioncancel');
}, 'Transitions on ::marker pseudo-elements are canceled when the'
+ ' parent display type is no longer list-item');
</script>
</body>
</html>