1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/content/base/test/test_bug398243.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,56 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<html> 1.6 +<!-- 1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=398243 1.8 +--> 1.9 +<head> 1.10 + <title>Test for Bug 398243</title> 1.11 + <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> 1.12 + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 1.13 +</head> 1.14 +<body> 1.15 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=398243">Mozilla Bug 398243</a> 1.16 +<p id="display"></p> 1.17 +<div id="content" style="display: none"> 1.18 +</div> 1.19 + <iframe id="testframe" src="http://mochi.test:8888/tests/content/base/test/formReset.html"></iframe> 1.20 +<pre id="test"> 1.21 +<script class="testbody" type="text/javascript"> 1.22 +/** Test for Bug 398243 **/ 1.23 +const enteredText1 = "New value for text input"; 1.24 +const enteredText2 = "New value for texarea"; 1.25 +SimpleTest.waitForExplicitFinish(); 1.26 + 1.27 +function afterLoad() { 1.28 + var iframeDoc = $("testframe").contentDocument; 1.29 + /* change all the form controls */ 1.30 + iframeDoc.getElementById("checkbox1").checked = true; 1.31 + iframeDoc.getElementById("checkbox2").checked = false; 1.32 + iframeDoc.getElementById("textinput").value = enteredText1; 1.33 + iframeDoc.getElementById("textarea").value = enteredText2; 1.34 + 1.35 + /* Reload the page */ 1.36 + $("testframe").setAttribute("onload", "afterReload()"); 1.37 + iframeDoc.location.reload(); 1.38 +} 1.39 + 1.40 +addLoadEvent(afterLoad); 1.41 + 1.42 +function afterReload() { 1.43 + var iframeDoc = $("testframe").contentDocument; 1.44 + is(iframeDoc.getElementById("checkbox1").checked, true, 1.45 + "checkbox #1 state preserved"); 1.46 + is(iframeDoc.getElementById("checkbox2").checked, false, 1.47 + "checkbox #2 state preserved"); 1.48 + is(iframeDoc.getElementById("textinput").value, enteredText1, 1.49 + "text preserved in <input>"); 1.50 + is(iframeDoc.getElementById("textarea").value, enteredText2, 1.51 + "text preserved in <textarea>"); 1.52 + 1.53 + SimpleTest.finish(); 1.54 +} 1.55 +</script> 1.56 +</pre> 1.57 +</body> 1.58 +</html> 1.59 +