OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src="../../../resources/js-test.js"></script> | 4 <script src="../../../resources/js-test.js"></script> |
5 </head> | 5 </head> |
6 <body> | 6 <body> |
7 <dialog> | 7 <dialog> |
8 <form method="dialog"> | 8 <form method="dialog"> |
9 <input id="goodbye" type="submit" value="Goodbye"> | 9 <input id="goodbye" type="submit" value="Goodbye"> |
10 <input id="hello" type="submit" value="Hello"> | 10 <input id="hello" type="submit" value="Hello"> |
11 </form> | 11 </form> |
12 </dialog> | 12 </dialog> |
13 <script> | 13 <script> |
14 description('Tests submitting a dialog on a close event triggered by a previous
submission.'); | 14 description('Tests submitting a dialog on a close event triggered by a previous
submission.'); |
15 | 15 |
| 16 window.jsTestIsAsync = true; |
16 function testGoodbye() | 17 function testGoodbye() |
17 { | 18 { |
18 dialog = document.querySelector('dialog'); | 19 dialog = document.querySelector('dialog'); |
19 dialog.show(); | 20 dialog.show(); |
20 dialog.addEventListener('close', function f() { | 21 dialog.addEventListener('close', function f() { |
21 dialog.removeEventListener('close', f); | 22 dialog.removeEventListener('close', f); |
22 shouldBeFalse('dialog.open'); | 23 shouldBeFalse('dialog.open'); |
23 shouldBeEqualToString('dialog.returnValue', 'Goodbye'); | 24 shouldBeEqualToString('dialog.returnValue', 'Goodbye'); |
24 testHello(); | 25 testHello(); |
25 }); | 26 }); |
26 document.querySelector('#goodbye').click(); | 27 document.querySelector('#goodbye').click(); |
27 } | 28 } |
28 | 29 |
29 function testHello() | 30 function testHello() |
30 { | 31 { |
31 dialog = document.querySelector('dialog'); | 32 dialog = document.querySelector('dialog'); |
32 dialog.show(); | 33 dialog.show(); |
33 dialog.addEventListener('close', function() { | 34 dialog.addEventListener('close', function() { |
34 shouldBeFalse('dialog.open'); | 35 shouldBeFalse('dialog.open'); |
35 shouldBeEqualToString('dialog.returnValue', 'Hello'); | 36 shouldBeEqualToString('dialog.returnValue', 'Hello'); |
36 if (window.testRunner) | 37 finishJSTest(); |
37 testRunner.notifyDone(); | |
38 }); | 38 }); |
39 document.querySelector('#hello').click(); | 39 document.querySelector('#hello').click(); |
40 } | 40 } |
41 | 41 |
42 if (window.testRunner) | |
43 testRunner.waitUntilDone(); | |
44 testGoodbye(); | 42 testGoodbye(); |
45 </script> | 43 </script> |
46 </body> | 44 </body> |
47 </html> | 45 </html> |
OLD | NEW |