parser/htmlparser/tests/mochitest/test_bug566879.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/parser/htmlparser/tests/mochitest/test_bug566879.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,60 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<!--
     1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=566879
     1.8 +-->
     1.9 +<head>
    1.10 +  <title>Test for Bug 566879</title>
    1.11 +  <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
    1.12 +  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.13 +  <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
    1.14 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
    1.15 +</head>
    1.16 +<body onload='runTest();'>
    1.17 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=566879">Mozilla Bug 566879</a>
    1.18 +<p id="display"></p>
    1.19 +<div id="content" style="display: none">
    1.20 +<form>
    1.21 +<input type=text id=textfield name=textfield>
    1.22 +<input type=checkbox id=checkbox name=checkbox>
    1.23 +<input type=radio id=radio1 name=radio>
    1.24 +<input type=radio id=radio2 name=radio>
    1.25 +<textarea name=textarea id=textarea></textarea>
    1.26 +<select name=select id=select>
    1.27 +<option value=foo>Foo</option>
    1.28 +<option value=bar selected>Bar</option>
    1.29 +</select>
    1.30 +</form>  
    1.31 +</div>
    1.32 +<pre id="test">
    1.33 +<script class="testbody" type="text/javascript">
    1.34 +function runTest() {
    1.35 +  initialState = document.getElementById('content').innerHTML;
    1.36 +  document.getElementById('textfield').value = "foo";
    1.37 +  document.getElementById('checkbox').checked = true;
    1.38 +  document.getElementById('radio2').checked = true;
    1.39 +  document.getElementById('textarea').value = "foo";
    1.40 +  document.getElementById('select').value = "foo";
    1.41 +  setTimeout(continuation1, 1);
    1.42 +}
    1.43 +
    1.44 +function continuation1() {
    1.45 +  document.getElementById('content').innerHTML = initialState;
    1.46 +  setTimeout(continuation2, 1);
    1.47 +}
    1.48 +
    1.49 +function continuation2() {
    1.50 +  is(document.getElementById('textfield').value, "", "The text field should have gone back to its initial state.");
    1.51 +  ok(!document.getElementById('checkbox').checked, "The checkbox should have gone back to its initial state.");
    1.52 +  ok(!document.getElementById('radio2').checked, "The second radio button should have gone back to its initial state.");
    1.53 +  is(document.getElementById('textarea').value, "", "The text area should have gone back to its initial state.");
    1.54 +  is(document.getElementById('select').value, "bar", "The select should have gone back to its initial state.");
    1.55 +  SimpleTest.finish();
    1.56 +}
    1.57 +
    1.58 +SimpleTest.waitForExplicitFinish();
    1.59 +</script>
    1.60 +</pre>
    1.61 +</body>
    1.62 +</html>
    1.63 +

mercurial