parser/htmlparser/tests/mochitest/test_bug566879.html

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

mercurial