Bug 1800456 - Add preconditions to css-view-transitions tests, r=emilio
[gecko.git] / testing / web-platform / tests / css / css-view-transitions / no-containment-on-old-element.html
blob8b21916019e1880212a9803d4205556ba402d169
1 <!DOCTYPE html>
2 <html>
3 <title>View transitions: transition skipped if no containment on old element</title>
4 <link rel="help" href="https://www.w3.org/TR/css-view-transitions-1/">
5 <link rel="author" href="mailto:khushalsagar@chromium.org">
7 <script src="/resources/testharness.js"></script>
8 <script src="/resources/testharnessreport.js"></script>
10 <style>
11 div {
12 width: 100px;
13 height: 100px;
14 background: blue;
15 view-transition-name: target;
17 </style>
19 <div id=first></div>
21 <script>
22 promise_test(async t => {
23 assert_implements(document.startViewTransition, "Missing document.startViewTransition");
24 return new Promise(async (resolve, reject) => {
25 let transition = document.startViewTransition(() => {
26 first.style.contain = "paint";
27 });
29 let readyRejected = false;
30 transition.ready.then(reject, () => { readyRejected = true; });
32 let domUpdated = false;
33 transition.domUpdated.then(() => { domUpdated = true; }, reject);
34 transition.finished.then(() => {
35 assert_true(readyRejected, "ready not rejected");
36 assert_true(domUpdated, "dom not updated");
38 if (window.getComputedStyle(first).contain == "paint")
39 resolve();
40 else
41 reject("dom update callback did not run");
43 }, reject);
44 });
45 }, "uncontained old element should skip the transition");
46 </script>