Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(946)

Side by Side Diff: third_party/WebKit/LayoutTests/fast/dom/HTMLDialogElement/dialog-show-modal.html

Issue 2671603003: Move DIALOG element tests to html/dialog/. (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../../resources/js-test.js"></script>
5 </head>
6 <body>
7 <dialog id="mydialog">It's my dialog.</dialog>
8 <script>
9 description("Tests that showModal() performs the steps specified in the HTML spe c. bug 97425");
10
11 dialog = document.getElementById('mydialog');
12 computedStyle = window.getComputedStyle(dialog, null);
13 shouldBeEqualToString("computedStyle.getPropertyValue('display')", "none");
14
15 dialog.showModal();
16 shouldBeEqualToString("computedStyle.getPropertyValue('display')", "block");
17
18 // The quoted texts output below are from <http://www.whatwg.org/specs/web-apps/ current-work/multipage/commands.html#dom-dialog-showmodal>.
19 debug('"If dialog already has an open attribute, then throw an InvalidStateError exception."');
20 shouldThrow('dialog.showModal();', '"InvalidStateError: Failed to execute \'show Modal\' on \'HTMLDialogElement\': The element already has an \'open\' attribute, and therefore cannot be opened modally."');
21
22 dialog.close();
23 shouldBeEqualToString("computedStyle.getPropertyValue('display')", "none");
24
25 dialog.parentNode.removeChild(dialog);
26 debug('"If dialog is not in a Document, then throw an InvalidStateError exceptio n."');
27 shouldThrow('dialog.showModal();', '"InvalidStateError: Failed to execute \'show Modal\' on \'HTMLDialogElement\': The element is not in a Document."');
28
29 doc = document.implementation.createHTMLDocument();
30 doc.body.appendChild(dialog);
31 shouldBeFalse("dialog.open");
32 dialog.showModal();
33 debug('Although the document is not attached to any pages, showModal() should ex ecute as normal.');
34 shouldBeTrue("dialog.open");
35 </script>
36 </body>
37 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698