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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/dom/HTMLDialogElement/dialog-close-event.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></dialog>
8 <script>
9 description("Test that dialog receives a close event upon closing.");
10 jsTestIsAsync = true;
11
12 document.addEventListener('close', function(event) {
13 testFailed("The 'close' event unexpectedly bubbled.");
14 });
15
16 closedCount = 0;
17 dialog = document.querySelector('dialog');
18 dialog.addEventListener('close', function(event) {
19 closedCount++;
20 selfDialog = this;
21 shouldBe('selfDialog', 'dialog');
22 shouldBeFalse('dialog.open');
23 shouldBeFalse('event.cancelable');
24 event.preventDefault();
25
26 if (closedCount == 1) {
27 dialog.show();
28 dialog.close();
29 // dialog's close event handler shouldn't be called synchronously.
30 shouldBe('closedCount', '1');
31 } else if (closedCount == 2) {
32 finishJSTest();
33 }
34 });
35
36 dialog.show();
37 dialog.close();
38
39 // Verify that preventDefault() didn't cancel closing.
40 shouldBeFalse('dialog.open');
41
42 // dialog's close event handler shouldn't be called synchronously.
43 shouldBe('closedCount', '0');
44 </script>
45 </body>
46 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698