only-child-on-root-element-with-view-transition.html (1175B)
1 <!DOCTYPE html> 2 <html class="reftest-wait foo"> 3 <title>View transitions: ensure :only-child is supported on view-transition</title> 4 <link rel="help" href="https://drafts.csswg.org/css-view-transitions-1/"> 5 <link rel="author" href="mailto:khushalsagar@chromium.org"> 6 7 <script src="/resources/testharness.js"></script> 8 <script src="/resources/testharnessreport.js"></script> 9 10 <style> 11 ::view-transition { 12 background-color: red; 13 } 14 15 html:only-child { 16 background-color: blue; 17 } 18 19 :root:only-child { 20 background-color: blue; 21 } 22 23 :only-child { 24 background-color: blue; 25 } 26 27 .foo:only-child { 28 background-color: blue; 29 } 30 </style> 31 32 <script> 33 promise_test(() => { 34 assert_implements(document.startViewTransition, "Missing document.startViewTransition"); 35 return new Promise(async (resolve, reject) => { 36 let transition = document.startViewTransition(); 37 transition.ready.then(() => { 38 let style = getComputedStyle( 39 document.documentElement, "::view-transition"); 40 if (style.backgroundColor == "rgb(255, 0, 0)") 41 resolve(); 42 else 43 reject(style.backgroundColor); 44 }); 45 }); 46 }, ":only-child is not supported on view-transition"); 47 </script>