Adding tests contributed by jlurz24@gmail.com

This commit is contained in:
bzbarsky@mit.edu 2007-08-09 11:43:35 -07:00
parent 8d592536a0
commit b73c8f1a0e
8 changed files with 277 additions and 0 deletions

View File

@ -69,6 +69,13 @@ _TEST_FILES = test_bug589.html \
bug340800_iframe.txt \
test_bug340800.html \
test_bug330705-1.html \
test_bug332893-1.html \
test_bug332893-2.html \
test_bug332893-3.html \
test_bug332893-4.html \
test_bug332893-5.html \
test_bug332893-6.html \
test_bug353415-1.html \
test_bug371375.html \
test_bug373589.html \
bug372098-link-target.html \

View File

@ -0,0 +1,39 @@
<!DOCTYPE html>
<html>
<head>
<title>Test</title>
<script type="text/javascript" src="/MochiKit/packed.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
</head>
<body>
<form id="form1">
<input id="F1I1" type="input" value="11"/>
<input id="F1I2" type="input" value="12"/>
</form>
<form id="form2">
<input id="F2I1" type="input" value="21"/>
<input id="F2I2" type="input" value="22"/>
</form>
<script>
<!-- Create a new input, add it to the first form, move it to the 2nd form, then move it back to the first -->
var form1 = document.getElementById("form1");
var form2 = document.getElementById("form2");
var newInput = document.createElement("input");
newInput.value = "13";
form1.insertBefore(newInput, form1.firstChild);
var F2I2 = document.getElementById("F2I2");
form2.insertBefore(newInput, F2I2);
form1.insertBefore(newInput, form1.firstChild);
is(form1.elements.length, "3", "Form 1 has the correct length");
is(form1.elements[0].value, "13", "Form 1 element 1 is correct");
is(form1.elements[1].value, "11", "Form 1 element 2 is correct");
is(form1.elements[2].value, "12", "Form 1 element 3 is correct");
is(form2.elements.length, "2", "Form 2 has the correct length");
is(form2.elements[0].value, "21", "Form 2 element 1 is correct");
is(form2.elements[1].value, "22", "Form 2 element 2 is correct");
</script>
</body>
</html>

View File

@ -0,0 +1,49 @@
<!DOCTYPE html>
<html>
<head>
<title>Test</title>
<script type="text/javascript" src="/MochiKit/packed.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
</head>
<body>
<form id="form1">
<table>
<tbody id="table1">
<tr id="F1I1"><td><input type="input" value="11"/></td></tr>
<tr id="F1I2"><td><input type="input" value="12"/></td></tr>
</tbody>
</table>
</form>
<form id="form2">
<table>
<tbody id="table2">
<tr id="F2I1"><td><input type="input" value="21"/></td></tr>
<tr id="F2I2"><td><input type="input" value="22"/></td></tr>
</tbody>
</table>
</form>
<script>
var table1 = document.getElementById("table1");
var F1I1 = table1.getElementsByTagName("tr")[0];
table1.removeChild(F1I1);
var table2 = document.getElementById("table2");
table2.insertBefore(F1I1, table2.firstChild);
var form1 = document.getElementById("form1");
var form2 = document.getElementById("form2");
is(form1.elements.length, 1, "Form 1 length is correct");
is(form1.elements[0].value, "12", "Form 1 element is correct");
is(form2.elements.length, 3, "Form 2 length is correct");
is(form2.elements[0].value, "11", "Form 2 element 1 is correct");
is(form2.elements[1].value, "21", "Form 2 element 2 is correct");
is(form2.elements[2].value, "22", "Form 2 element 3 is correct");
</script>
</body>
</html>

View File

@ -0,0 +1,54 @@
<!DOCTYPE html>
<html>
<head>
<title>Test</title>
<script type="text/javascript" src="/MochiKit/packed.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
</head>
<body>
<form id="form1">
<table>
<tbody>
<tr>
<td>
<table>
<tbody id="table1">
<tr id="F1I1"><td><input type="input" value="11"/></td></tr>
<tr id="F1I2"><td><input type="input" value="12"/></td></tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</form>
<form id="form2">
<table>
<tbody id="table2">
<tr id="F2I1"><td><input type="input" value="21"/></td></tr>
<tr id="F2I2"><td><input type="input" value="22"/></td></tr>
</tbody>
</table>
</form>
<script>
var table1 = document.getElementById("table1");
var F1I1 = table1.getElementsByTagName("tr")[0];
table1.removeChild(F1I1);
var table2 = document.getElementById("table2");
table2.insertBefore(F1I1, table2.firstChild);
var form1 = document.getElementById("form1");
var form2 = document.getElementById("form2");
is(form1.elements.length, "1", "Form 1 has the correct length");
is(form1.elements[0].value, "12", "Form 1 element 1 is correct");
is(form2.elements.length, "3", "Form 2 has the correct length");
is(form2.elements[0].value, "11", "Form 2 element 1 is correct");
is(form2.elements[1].value, "21", "Form 2 element 2 is correct");
is(form2.elements[2].value, "22", "Form 2 element 2 is correct");
</script>
</body>
</html>

View File

@ -0,0 +1,30 @@
<!DOCTYPE html>
<html>
<head>
<title>Test</title>
<script type="text/javascript" src="/MochiKit/packed.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
</head>
<body>
<form id="form1">
<input id="input1" type="input" name="input" value="1"/>
<input id="input2" type="input" name="input" value="2"/>
<input id="input3" type="input" name="input" value="3"/>
</form>
<script>
var input1 = document.getElementById("input1");
var input2 = document.getElementById("input2");
var form1 = document.getElementById("form1");
form1.insertBefore(input2, input1);
is(form1.elements["input"].length, "3", "Form 1 'input' has the correct length");
todo(form1.elements["input"][0].value == "2", "Form 1 element 1 is correct");
todo(form1.elements["input"][1].value == "1", "Form 1 element 2 is correct");
todo(form1.elements["input"][2].value == "3", "Form 1 element 3 is correct");
todo(form1.elements["input"][0].id == "input2", "Form 1 element 1 id is correct");
todo(form1.elements["input"][1].id == "input1", "Form 1 element 2 id is correct");
todo(form1.elements["input"][2].id == "input3", "Form 1 element 3 id is correct");
</script>
</body>
</html>

View File

@ -0,0 +1,30 @@
<!DOCTYPE html>
<html>
<head>
<title>Test</title>
<script type="text/javascript" src="/MochiKit/packed.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
</head>
<body>
<form id="form1">
<input id="input1" type="input" name="input" value="1"/>
<input id="input" type="input" name="input_other" value="2"/>
<input id="input3" type="input" name="input" value="3"/>
</form>
<script>
var input1 = document.getElementById("input1");
var input2 = document.getElementById("input");
var form1 = document.getElementById("form1");
form1.insertBefore(input2, input1);
is(form1.elements["input"].length, "3", "Form 1 'input' has the correct length");
todo(form1.elements["input"][0].value == "2", "Form 1 element 1 is correct");
todo(form1.elements["input"][1].value == "1", "Form 1 element 2 is correct");
todo(form1.elements["input"][2].value == "3", "Form 1 element 3 is correct");
todo(form1.elements["input"][0].id == "input", "Form 1 element 1 id is correct");
todo(form1.elements["input"][1].id == "input1", "Form 1 element 2 id is correct");
todo(form1.elements["input"][2].id == "input3", "Form 1 element 3 id is correct");
</script>
</body>
</html>

View File

@ -0,0 +1,28 @@
<!DOCTYPE html>
<html>
<head>
<title>Test</title>
<script type="text/javascript" src="/MochiKit/packed.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
</head>
<body>
<form id="form1">
<input id="input1" type="input" name="input" value="1"/>
<input id="input" type="input" name="input_other" value="2"/>
<input id="input3" type="input" name="input" value="3"/>
</form>
<script>
var input1 = document.getElementById("input1");
var input2 = document.getElementById("input");
var form1 = document.getElementById("form1");
form1.insertBefore(input2, input1);
is(form1.elements["input"].length, "3", "Form 1 'input' has the correct length");
todo(form1.elements["input"][0].value == "2", "Form 1 element 1 is correct");
todo(form1.elements["input"][1].value == "1", "Form 1 element 2 is correct");
todo(form1.elements["input"][0].id == "input", "Form 1 element 1 id is correct");
todo(form1.elements["input"][1].id == "input1", "Form 1 element 2 id is correct");
</script>
</body>
</html>

View File

@ -0,0 +1,40 @@
<!DOCTYPE html>
<html>
<head>
<title>Test</title>
<script type="text/javascript" src="/MochiKit/packed.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
</head>
<body>
<iframe name="submit_frame" onLoad="doCheck();"></iframe>
<form method="get" id="form1" target="submit_frame" action="../../../../../blah">
<input type="text" name="field1" value="teststring"><br>
<input type="radio" name="field2" value="0" checked> 0
<input type="radio" name="field3" value="1"> 1<br>
<input type="checkbox" name="field4" value="1" checked> 1
<input type="checkbox" name="field5" value="2"> 2
<input type="checkbox" name="field6" value="3" checked> 3
<select name="field7">
<option value="1">1</option>
<option value="2" selected>2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
<input name="field8" value="8">
<input name="field9" value="9">
<input type="image" name="field10">
<label name="field11">
<input name="field12">
<input type="button" name="field13" value="button">
</form>
<script>
document.forms[0].submit();
SimpleTest.waitForExplicitFinish();
function doCheck(){
is(frames['submit_frame'].location.href, "http://localhost:8888/blah?field1=teststring&field2=0&field4=1&field6=3&field7=2&field8=8&field9=9&field12=", "Submit string was correct.");
SimpleTest.finish();
}
</script>
</body>
</html>