dialog-open-2.html (1071B)
1 <!DOCTYPE html> 2 <link rel=author href="mailto:jarhar@chromium.org"> 3 <link rel=author href="mailto:falken@chromium.org"> 4 <link rel=help href="https://html.spec.whatwg.org/multipage/interactive-elements.html#the-dialog-element"> 5 <link rel=help href="https://bugs.webkit.org/show_bug.cgi?id=90931"> 6 <script src="/resources/testharness.js"></script> 7 <script src="/resources/testharnessreport.js"></script> 8 9 <dialog id=mydialog>It's my dialog.</dialog> 10 11 <script> 12 test(() => { 13 const dialog = document.getElementById('mydialog'); 14 let computedStyle = window.getComputedStyle(dialog, null); 15 assert_equals(computedStyle.getPropertyValue('display'), 'none'); 16 17 dialog.show(); 18 computedStyle = window.getComputedStyle(dialog, null); 19 assert_equals(computedStyle.getPropertyValue('display'), 'block'); 20 21 dialog.close(); 22 computedStyle = window.getComputedStyle(dialog, null); 23 24 assert_equals(computedStyle.getPropertyValue('display'), 'none'); 25 dialog.close(); 26 }, "Tests that dialog is visible after show() is called and not visible after close() is called."); 27 </script>