test_bug566879.html (2213B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=566879 5 --> 6 <head> 7 <title>Test for Bug 566879</title> 8 <script src="/tests/SimpleTest/SimpleTest.js"></script> 9 <script src="/tests/SimpleTest/EventUtils.js"></script> 10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 11 </head> 12 <body onload='runTest();'> 13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=566879">Mozilla Bug 566879</a> 14 <p id="display"></p> 15 <div id="content" style="display: none"> 16 <form> 17 <input type=text id=textfield name=textfield> 18 <input type=checkbox id=checkbox name=checkbox> 19 <input type=radio id=radio1 name=radio> 20 <input type=radio id=radio2 name=radio> 21 <textarea name=textarea id=textarea></textarea> 22 <select name=select id=select> 23 <option value=foo>Foo</option> 24 <option value=bar selected>Bar</option> 25 </select> 26 </form> 27 </div> 28 <pre id="test"> 29 <script class="testbody" type="text/javascript"> 30 var initialState; 31 32 function runTest() { 33 initialState = document.getElementById("content").innerHTML; 34 document.getElementById("textfield").value = "foo"; 35 document.getElementById("checkbox").checked = true; 36 document.getElementById("radio2").checked = true; 37 document.getElementById("textarea").value = "foo"; 38 document.getElementById("select").value = "foo"; 39 setTimeout(continuation1, 1); 40 } 41 42 function continuation1() { 43 document.getElementById("content").innerHTML = initialState; 44 setTimeout(continuation2, 1); 45 } 46 47 function continuation2() { 48 is(document.getElementById("textfield").value, "", "The text field should have gone back to its initial state."); 49 ok(!document.getElementById("checkbox").checked, "The checkbox should have gone back to its initial state."); 50 ok(!document.getElementById("radio2").checked, "The second radio button should have gone back to its initial state."); 51 is(document.getElementById("textarea").value, "", "The text area should have gone back to its initial state."); 52 is(document.getElementById("select").value, "bar", "The select should have gone back to its initial state."); 53 SimpleTest.finish(); 54 } 55 56 SimpleTest.waitForExplicitFinish(); 57 SimpleTest.requestFlakyTimeout("untriaged"); 58 </script> 59 </pre> 60 </body> 61 </html>