top-layer-dialog.html (1368B)
1 <!doctype html> 2 <title>CSS Container Queries Test: @container with modal dialog child</title> 3 <link rel="help" href="https://drafts.csswg.org/css-conditional-5/#container-queries"> 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 <script src="support/cq-testcommon.js"></script> 7 <style> 8 #container { 9 container-type: inline-size; 10 } 11 dialog { 12 color: red; 13 } 14 @container (max-width: 200px) { 15 dialog { color: green; } 16 } 17 @container (max-width: 100px) { 18 dialog { color: lime; } 19 } 20 </style> 21 <div id="container"> 22 <dialog id="dialog"></dialog> 23 </div> 24 <script> 25 setup(() => assert_implements_size_container_queries()); 26 27 test(() => { 28 assert_equals(getComputedStyle(dialog).color, "rgb(255, 0, 0)"); 29 }, "#container initially wider than 200px"); 30 31 test(() => { 32 container.style.width = "200px"; 33 assert_equals(getComputedStyle(dialog).color, "rgb(0, 128, 0)"); 34 }, "#container changed to 200px"); 35 36 test(() => { 37 dialog.showModal(); 38 assert_equals(getComputedStyle(dialog).color, "rgb(0, 128, 0)"); 39 }, "Modal dialog still has parent as query container while in top layer"); 40 41 test(() => { 42 container.style.width = "100px"; 43 assert_equals(getComputedStyle(dialog).color, "rgb(0, 255, 0)"); 44 }, "Container changes width while dialog is in top layer"); 45 </script>