| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <script src="../../js/resources/js-test-pre.js"></script> | 4 <script src="../../js/resources/js-test-pre.js"></script> |
| 5 <script> | 5 <script> |
| 6 if (window.internals) | 6 if (window.internals) |
| 7 internals.settings.setDialogElementEnabled(true); | 7 internals.settings.setDialogElementEnabled(true); |
| 8 </script> | 8 </script> |
| 9 </head> | 9 </head> |
| 10 <body> | 10 <body> |
| 11 <dialog id="mydialog">It's my dialog.</dialog> | 11 <dialog id="mydialog">It's my dialog.</dialog> |
| 12 <script> | 12 <script> |
| 13 description("Tests that showModal() performs the steps specified in the HTML spe
c. bug 97425"); | 13 description("Tests that showModal() performs the steps specified in the HTML spe
c. bug 97425"); |
| 14 | 14 |
| 15 dialog = document.getElementById('mydialog'); | 15 dialog = document.getElementById('mydialog'); |
| 16 computedStyle = window.getComputedStyle(dialog, null); | 16 computedStyle = window.getComputedStyle(dialog, null); |
| 17 shouldBeEqualToString("computedStyle.getPropertyValue('display')", "none"); | 17 shouldBeEqualToString("computedStyle.getPropertyValue('display')", "none"); |
| 18 | 18 |
| 19 dialog.showModal(); | 19 dialog.showModal(); |
| 20 shouldBeEqualToString("computedStyle.getPropertyValue('display')", "block"); | 20 shouldBeEqualToString("computedStyle.getPropertyValue('display')", "block"); |
| 21 | 21 |
| 22 // The quoted texts output below are from <http://www.whatwg.org/specs/web-apps/
current-work/multipage/commands.html#dom-dialog-showmodal>. | 22 // The quoted texts output below are from <http://www.whatwg.org/specs/web-apps/
current-work/multipage/commands.html#dom-dialog-showmodal>. |
| 23 debug('"If dialog already has an open attribute, then throw an InvalidStateError
exception."'); | 23 debug('"If dialog already has an open attribute, then throw an InvalidStateError
exception."'); |
| 24 shouldThrow('dialog.showModal();', "'Error: InvalidStateError: DOM Exception 11'
"); | 24 shouldThrow('dialog.showModal();', "'InvalidStateError: An attempt was made to u
se an object that is not, or is no longer, usable.'"); |
| 25 | 25 |
| 26 dialog.close(); | 26 dialog.close(); |
| 27 shouldBeEqualToString("computedStyle.getPropertyValue('display')", "none"); | 27 shouldBeEqualToString("computedStyle.getPropertyValue('display')", "none"); |
| 28 | 28 |
| 29 dialog.parentNode.removeChild(dialog); | 29 dialog.parentNode.removeChild(dialog); |
| 30 debug('"If dialog is not in a Document, then throw an InvalidStateError exceptio
n."'); | 30 debug('"If dialog is not in a Document, then throw an InvalidStateError exceptio
n."'); |
| 31 shouldThrow('dialog.showModal();', "'Error: InvalidStateError: DOM Exception 11'
"); | 31 shouldThrow('dialog.showModal();', "'InvalidStateError: An attempt was made to u
se an object that is not, or is no longer, usable.'"); |
| 32 | 32 |
| 33 doc = document.implementation.createHTMLDocument(); | 33 doc = document.implementation.createHTMLDocument(); |
| 34 doc.body.appendChild(dialog); | 34 doc.body.appendChild(dialog); |
| 35 shouldBeFalse("dialog.open"); | 35 shouldBeFalse("dialog.open"); |
| 36 dialog.showModal(); | 36 dialog.showModal(); |
| 37 debug('Although the document is not attached to any pages, showModal() should ex
ecute as normal.'); | 37 debug('Although the document is not attached to any pages, showModal() should ex
ecute as normal.'); |
| 38 shouldBeTrue("dialog.open"); | 38 shouldBeTrue("dialog.open"); |
| 39 </script> | 39 </script> |
| 40 <script src="../../js/resources/js-test-post.js"></script> | 40 <script src="../../js/resources/js-test-post.js"></script> |
| 41 </body> | 41 </body> |
| 42 </html> | 42 </html> |
| OLD | NEW |