| <!DOCTYPE html> |
| <html> |
| <head> |
| <script src="../../../resources/js-test.js"></script> |
| </head> |
| <body> |
| <dialog> |
| <form method="dialog"> |
| <input id="goodbye" type="submit" value="Goodbye"> |
| <input id="hello" type="submit" value="Hello"> |
| </form> |
| </dialog> |
| <script> |
| description('Tests submitting a dialog on a close event triggered by a previous submission.'); |
| |
| function testGoodbye() |
| { |
| dialog = document.querySelector('dialog'); |
| dialog.show(); |
| dialog.addEventListener('close', function f() { |
| dialog.removeEventListener('close', f); |
| shouldBeFalse('dialog.open'); |
| shouldBeEqualToString('dialog.returnValue', 'Goodbye'); |
| testHello(); |
| }); |
| document.querySelector('#goodbye').click(); |
| } |
| |
| function testHello() |
| { |
| dialog = document.querySelector('dialog'); |
| dialog.show(); |
| dialog.addEventListener('close', function() { |
| shouldBeFalse('dialog.open'); |
| shouldBeEqualToString('dialog.returnValue', 'Hello'); |
| if (window.testRunner) |
| testRunner.notifyDone(); |
| }); |
| document.querySelector('#hello').click(); |
| } |
| |
| if (window.testRunner) |
| testRunner.waitUntilDone(); |
| testGoodbye(); |
| </script> |
| </body> |
| </html> |