- add third_party src.
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / fast / dom / HTMLDialogElement / dialog-return-value.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../js/resources/js-test-pre.js"></script>
5 </head>
6 <body>
7 <dialog id="test-dialog"></dialog>
8 <script>
9 description("Tests that dialog.returnValue is settable and returns the last value set.");
10
11 dialog = document.getElementById('test-dialog');
12 shouldBe("dialog.returnValue", "''");
13
14 dialog.returnValue = 'Setting value directly';
15 shouldBe("dialog.returnValue", "'Setting value directly'");
16
17 dialog.returnValue = null;
18 shouldBe("dialog.returnValue", "'null'");
19
20 dialog.returnValue = '';
21 shouldBe("dialog.returnValue", "''");
22
23 dialog.returnValue = 7;
24 shouldBe("dialog.returnValue", "'7'");
25
26 dialog.show();
27 dialog.close('Return value set from close()');
28 shouldBe("dialog.returnValue", "'Return value set from close()'");
29
30 dialog.show();
31 dialog.close('');
32 shouldBe("dialog.returnValue", "''");
33
34 dialog.show();
35 dialog.close(null);
36 shouldBe("dialog.returnValue", "'null'");
37
38 dialog.returnValue = 'Should not change because no argument to close()';
39 dialog.show();
40 dialog.close();
41 shouldBe("dialog.returnValue", "'Should not change because no argument to close()'");
42
43 dialog.returnValue = 'Should not change because close() is invalid';
44 shouldThrow("dialog.close('blah')", "'InvalidStateError: An attempt was made to use an object that is not, or is no longer, usable.'");
45 shouldBe("dialog.returnValue", "'Should not change because close() is invalid'");
46 </script>
47 </body>
48 </html>