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 onload="runTest()"> | 6 <body onload="runTest()"> |
7 <p>Test to restore form value states for a radio group.</p> | 7 <p>Test to restore form value states for a radio group.</p> |
8 <div id="console"></div> | 8 <div id="console"></div> |
9 | 9 |
10 <input id=emptyOnFirstVisit> | 10 <input id=emptyOnFirstVisit> |
11 <div id=parent> | 11 <div id=parent> |
12 <form action="data:text/html,<script>history.back()</script>" id=form1> | 12 <form action="../../../resources/back.html" id=form1> |
13 <input name=user type=radio id=input1> | 13 <input name=user type=radio id=input1> |
14 <input checked name=user type=radio id=input2> | 14 <input checked name=user type=radio id=input2> |
15 </form> | 15 </form> |
16 </div> | 16 </div> |
17 | 17 |
18 <script> | 18 <script> |
19 | 19 |
20 function runTest() { | 20 function runTest() { |
21 var parent = document.getElementById('parent'); | 21 var parent = document.getElementById('parent'); |
22 var state = document.getElementById('emptyOnFirstVisit'); | 22 var state = document.getElementById('emptyOnFirstVisit'); |
23 if (!state.value) { | 23 if (!state.value) { |
24 // First visit. | 24 // First visit. |
25 if (window.testRunner) | 25 if (window.testRunner) |
26 testRunner.waitUntilDone(); | 26 testRunner.waitUntilDone(); |
27 state.value = 'visited'; | 27 state.value = 'visited'; |
28 | 28 |
29 document.getElementById('input1').checked = true; | 29 document.getElementById('input1').checked = true; |
30 // Submit form in a timeout to make sure that we create a new back/forwa
rd list item. | 30 // Submit form in a timeout to make sure that we create a new back/forwa
rd list item. |
31 setTimeout(function() {document.getElementById('form1').submit();}, 0); | 31 setTimeout(function() {document.getElementById('form1').submit();}, 0); |
32 } else { | 32 } else { |
33 // Second visit. | 33 // Second visit. |
34 shouldBeTrue('document.getElementById("input1").checked'); | 34 shouldBeTrue('document.getElementById("input1").checked'); |
35 shouldBeFalse('document.getElementById("input2").checked'); | 35 shouldBeFalse('document.getElementById("input2").checked'); |
36 if (window.testRunner) | 36 if (window.testRunner) |
37 testRunner.notifyDone(); | 37 testRunner.notifyDone(); |
38 } | 38 } |
39 } | 39 } |
40 </script> | 40 </script> |
41 </body> | 41 </body> |
OLD | NEW |