Bug 368994. moving test cases closer to the code they test. r=bzbarsky

This commit is contained in:
sayrer%gmail.com 2007-02-01 18:06:09 +00:00
Родитель f2066df994
Коммит 4f5fc1df13
13 изменённых файлов: 405 добавлений и 12 удалений

Просмотреть файл

@ -44,7 +44,16 @@ relativesrcdir = content/html/content/test
include $(DEPTH)/config/autoconf.mk include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/rules.mk include $(topsrcdir)/config/rules.mk
_TEST_FILES = test_bug300691-1.html \ _TEST_FILES = test_bug589.html \
test_bug691.html \
nnc_lockup.gif \
test_bug694.html \
test_bug696.html \
test_bug1297.html \
test_bug1366.html \
test_bug1400.html \
test_bug2082.html \
test_bug300691-1.html \
test_bug300691-2.html \ test_bug300691-2.html \
test_bug300691-3.xhtml \ test_bug300691-3.xhtml \
$(NULL) $(NULL)

Просмотреть файл

@ -0,0 +1,47 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1297
-->
<head>
<title>Test for Bug 1297</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1297">Mozilla Bug 1297</a>
<p id="display"></p>
<div id="content" style="display: none">
<table border=1>
<tr>
<td id="td1" onmousedown="alert(this.cellIndex)">cellIndex=0</td>
<td id="td2" onmousedown="alert(this.cellIndex)">cellIndex=1</td>
<td id="td3" onmousedown="alert(this.cellIndex)">cellIndex=2</td>
<tr id="tr1"
onmousedown="alert(this.rowIndex)"><td>rowIndex=1<td>rowIndex=1<td>rowIndex=1</t
r>
<tr id="tr2"
onmousedown="alert(this.rowIndex)"><td>rowIndex=2<td>rowIndex=2<td>rowIndex=2</t
r>
</tr>
</table>
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 1297 **/
is($('td1').cellIndex, 0, "cellIndex / rowIndex working td1");
is($('td2').cellIndex, 1, "cellIndex / rowIndex working td2");
is($('td3').cellIndex, 2, "cellIndex / rowIndex working td3");
is($('tr1').rowIndex, 1, "cellIndex / rowIndex working tr1");
is($('tr2').rowIndex, 2, "cellIndex / rowIndex working tr2");
</script>
</pre>
</body>
</html>

Просмотреть файл

@ -0,0 +1,36 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1366
-->
<head>
<title>Test for Bug 1366</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1366">Mozilla Bug 1366</a>
<p id="display"></p>
<div id="content" style="display: none">
<table id="testtable" width=150 border>
<tbody id="testbody">
<tr>
<td>cell content</td>
</tr>
</tbody>
</table>
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 1366 **/
$('testtable').removeChild($('testbody'));
$('display').innerHTML = "SCRIPT: deleted first ROWGROUP\n";
is($('testbody'), null, "deleting tbody works");
</script>
</pre>
</body>
</html>

Просмотреть файл

@ -0,0 +1,43 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1400
-->
<head>
<title>Test for Bug 1400</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1400">Mozilla Bug 1400</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 1400 **/
table = document.createElement("TABLE");
thead = table.createTHead();
thead2 = table.createTHead();
table.appendChild(thead);
table.appendChild(thead);
table.appendChild(thead);
table.appendChild(thead2);
table.appendChild(thead2);
table.appendChild(thead2);
table.appendChild(thead);
table.appendChild(thead2);
is(table.childNodes.length, 1,
"adding multiple theads results in one thead child");
</script>
</pre>
</body>
</html>

Просмотреть файл

@ -0,0 +1,31 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=2082
-->
<head>
<title>Test for Bug 2082</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=2082">Mozilla Bug 2082</a>
<p id="display"></p>
<div id="content" style="display: none">
<FORM name="gui" id="gui">
<INPUT TYPE="text" NAME="field" VALUE="some value">
</FORM>
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 2082 **/
var guiform = document.getElementById("gui");
ok(document.getElementById("gui").hasChildNodes(), "form elements should be treated as form's children");
</script>
</pre>
</body>
</html>

Просмотреть файл

@ -0,0 +1,43 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=589
-->
<head>
<title>Test for Bug 589</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
<style type="text/css">
.letters {list-style-type: upper-alpha;}
.numbers {list-style-type: decimal;}
</style>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=589">Mozilla Bug 589</a>
<p id="display"></p>
<div id="content" >
<OL id="thelist" class="letters">
<LI id="liA">This list should feature...
<LI id="liB">...letters for each item...
<LI id="li3" class="numbers">...except this one.
</OL>
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 589 **/
is(computedStyle($("liA"),"list-style-type"),"upper-alpha");
is(computedStyle($("liB"),"list-style-type"),"upper-alpha");
is(computedStyle($("li3"),"list-style-type"),"decimal");
</script>
</pre>
</body>
</html>

Просмотреть файл

@ -0,0 +1,63 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=691
-->
<head>
<title>Test for Bug 691</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
<script type="text/javascript">
function show(what) {
var stage = document.getElementById("stage");
if (what == "modularity") {
var spaghetti = document.createElement("IMG",null);
spaghetti.setAttribute("SRC","/static/nnc_lockup.gif");
spaghetti.setAttribute("id","foo");
stage.insertBefore(spaghetti,stage.firstChild);
}
}
function remove() {
var stage = document.getElementById("stage");
var body = document.getElementsByTagName("BODY")[0];
while (stage.firstChild) {
stage.removeChild(stage.firstChild);
}
}
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=691">Mozilla Bug 691</a>
<p id="display"></p>
<div id="content" >
<ul>
<li >foo</li>
</ul>
<div id="stage">
</div>
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 691 **/
show("modularity");
remove();
show("modularity");
remove();
show("modularity");
remove();
show("modularity");
ok($("foo"), "basic DOM manipulation doesn't crash");
</script>
</pre>
</body>
</html>

Просмотреть файл

@ -0,0 +1,31 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=694
-->
<head>
<title>Test for Bug 694</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=694">Mozilla Bug 694</a>
<p id="display"></p>
<div id="content" >
<img src="/missing_on_purpose" width=123 height=25 alt="Hello, &quot;Quotes&quot; how are you?" id="testimg">
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 694 **/
is($("testimg").getAttribute("alt"), "Hello, \"Quotes\" how are you?", "entities in alt attribute works");
</script>
</pre>
</body>
</html>

Просмотреть файл

@ -0,0 +1,29 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=696
-->
<head>
<title>Test for Bug 696</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=696">Mozilla Bug 696</a>
<p id="display"></p>
<div id="content" style="display: none">
<table><tr id="mytr"><td>Foo</td><td>Bar</td></tr></table>
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 696 **/
var mytr = $("content").getElementsByTagName("TR")[0];
is(mytr.getAttribute("ID"),"mytr","TR tags expose their ID attribute");
</script>
</pre>
</body>
</html>

Просмотреть файл

@ -44,7 +44,9 @@ relativesrcdir = content/html/document/test
include $(DEPTH)/config/autoconf.mk include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/rules.mk include $(topsrcdir)/config/rules.mk
_TEST_FILES = test_bug172261.html \ _TEST_FILES = test_bug1682.html \
test_bug1823.html \
test_bug172261.html \
$(NULL) $(NULL)
libs:: $(_TEST_FILES) libs:: $(_TEST_FILES)

Просмотреть файл

@ -0,0 +1,38 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1682
-->
<head>
<title>Test for Bug 1682</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1682">Mozilla Bug 1682</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 1682 **/
var count = 1;
SimpleTest.waitForExplicitFinish();
addLoadEvent(function () {
is(count, 1, "onload executes once");
++count;
});
addLoadEvent(SimpleTest.finish);
</script>
</pre>
</body>
</html>

Просмотреть файл

@ -0,0 +1,31 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1823
-->
<head>
<title>Test for Bug 1823</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1823">Mozilla Bug 1823</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 1823 **/
ok((document.location + "").indexOf("[") == -1, "location object has a toString()");
</script>
</pre>
</body>
</html>

Просмотреть файл

@ -44,16 +44,6 @@ if (!params.quiet) {
var RunSet = {} var RunSet = {}
RunSet.runall = function() { RunSet.runall = function() {
TestRunner.runTests( TestRunner.runTests(
'test_bug589.html',
'test_bug691.html',
'test_bug694.html',
'test_bug696.html',
'test_bug1297.html',
'test_bug1366.html',
'test_bug1400.html',
'test_bug1682.html',
'test_bug1823.html',
'test_bug2082.html',
'test_bug3348.html', 'test_bug3348.html',
'test_bug5141.html', 'test_bug5141.html',
'test_bug6296.html', 'test_bug6296.html',