Skip to content

Commit

Permalink
Move transition-end-event-shorthand.html to WPT and deflake.
Browse files Browse the repository at this point in the history
Ensure that page has rendered before doing the style update to trigger
transitions. Switched to using the web-animations API in place of
windows.internals for cross-platform support.

Bug: 1267553
Change-Id: Ia6af19d38b50a1479ff43a7e9742d8575e646732
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3272694
Reviewed-by: Steve Kobes <skobes@chromium.org>
Commit-Queue: Kevin Ellis <kevers@chromium.org>
Cr-Commit-Position: refs/heads/main@{#940784}
  • Loading branch information
Kevin Ellis authored and chromium-wpt-export-bot committed Nov 11, 2021
1 parent 3bfd27c commit 5a3d7cd
Showing 1 changed file with 65 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>transition end event with shorthand property</title>
<link rel="help" href="https://drafts.csswg.org/css-transitions/#transition-property-property">
<style>
#box {
transition: padding 1s;
padding: 0px 1px 2px 3px; // top right bottom left
}
</style>
</head>
<body>
<div id="container">
<div id="box"></div>
</div>
</body>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/css-transitions/support/helper.js"></script>
<script>
window.onload = () => {
function timeoutPromise() {
return waitForAnimationFrames(5);
}

promise_test(async t => {
// Make sure we have rendered the page before making the style change
// to ensure we get transitions.
await waitForAnimationFrames(2);

// Change three padding properties, but preserve padding-bottom.
// This should trigger 3 transitions.
box.style.padding = "8px 7px 2px 5px";

const animations = document.getAnimations();
const properties =
animations.map(anim => anim.transitionProperty).sort();
assert_array_equals(properties,
['padding-left', 'padding-right', 'padding-top']);

// Expect a transitionend event for each of the CSSTransitions.
const eventWatcher =
new EventWatcher(t, box, 'transitionend', timeoutPromise);

const eventsPromise =
eventWatcher.wait_for(
['transitionend', 'transitionend', 'transitionend'],
{ record: 'all' }).then(events => {
events.forEach(event => {
assert_times_equal(event.elapsedTime, 1);
})
});
animations.forEach(anim => {
anim.finish();
});
await eventsPromise;

// Ensure no unexpected events are received.
await waitForAnimationFrames(2);
}, 'Transition end events generated for transition on shorthand property');
};
</script>
</html>

0 comments on commit 5a3d7cd

Please sign in to comment.