Bug 368994. Move mochitests near the code they test, round 6. r=bzbarsky

This commit is contained in:
sayrer@gmail.com 2007-04-14 10:46:36 -07:00
Родитель 727880c281
Коммит a149d26094
11 изменённых файлов: 408 добавлений и 9 удалений

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

@ -69,7 +69,11 @@ _TEST_FILES = test_bug5141.html \
test_bug357450_svg.xhtml \
test_bug357509.html \
test_bug358660.html \
test_bug362391.xhtml \
test_bug364092.xhtml \
test_bug364413.xhtml \
test_bug366946.html \
test_bug367164.html \
test_bug371576-1.html \
test_bug371576-2.html \
test_bug371576-3.html \

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

@ -0,0 +1,75 @@
<?xml version="1.0"?>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:foobar="http://www.foobar.com">
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=362391
-->
<head>
<title>Test for Bug 362391</title>
<!-- XHTML needs explicit script elements -->
<script type="text/javascript" src="/MochiKit/Base.js"></script>
<script type="text/javascript" src="/MochiKit/Iter.js"></script>
<script type="text/javascript" src="/MochiKit/DOM.js"></script>
<script type="text/javascript" src="/MochiKit/Style.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=362391">Mozilla Bug 362391</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<div id="test1"/>
<div id="test2"/>
<div id="test3" attr="null"/>
<div id="test4" foobar:attr="http://www.foobar.com"/>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 362391 **/
var currentTest = 0;
var expected = "";
function listener(evt) {
var r = document.getElementById("result");
++currentTest;
ok(((evt.relatedNode.namespaceURI + "") == expected),
evt.relatedNode.namespaceURI + " == "+ expected);
}
document.addEventListener("DOMAttrModified", listener, true);
function test() {
expected = "null";
document.getElementById("test1")
.setAttribute("attr", "null");
expected = "http://www.foobar.com";
document.getElementById("test2")
.setAttributeNS("http://www.foobar.com", "attr", "http://www.foobar.com");
expected = "http://www.foobar.com";
document.getElementById("test3")
.setAttributeNS("http://www.foobar.com", "attr", "http://www.foobar.com");
expected = "null";
document.getElementById("test4")
.setAttribute("attr", "null");
expected = "http://www.foobar.com";
document.getElementById("test3")
.removeAttributeNS("http://www.foobar.com", "attr");
expected = "null";
document.getElementById("test4")
.removeAttribute("attr");
}
test();
</script>
</pre>
</body>
</html>

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

@ -0,0 +1,46 @@
<?xml version="1.0"?>
<html xmlns="http://www.w3.org/1999/xhtml">
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=364092
-->
<head>
<title>Test for Bug 364092</title>
<!-- XHTML needs explicit script elements -->
<script type="text/javascript" src="/MochiKit/Base.js"></script>
<script type="text/javascript" src="/MochiKit/Iter.js"></script>
<script type="text/javascript" src="/MochiKit/DOM.js"></script>
<script type="text/javascript" src="/MochiKit/Style.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=364092">Mozilla Bug 364092</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<div id="test1" foo="foo"/>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 364092 **/
var test1 = document.getElementById("test1");
var attrNode = test1.getAttributeNode("foo");
function mutationHandler(aEvent) {
ok(attrNode.isSameNode(aEvent.relatedNode));
ok(!test1.hasAttribute("foo"));
}
function runTest() {
test1.addEventListener("DOMAttrModified", mutationHandler, true);
test1.removeAttributeNode(attrNode);
test1.removeEventListener("DOMAttrModified", mutationHandler, true);
}
runTest();
</script>
</pre>
</body>
</html>

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

@ -0,0 +1,48 @@
<?xml version="1.0"?>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:foobar="http://www.foobar.com">
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=364413
-->
<head>
<title>Test for Bug 364413</title>
<!-- XHTML needs explicit script elements -->
<script type="text/javascript" src="/MochiKit/Base.js"></script>
<script type="text/javascript" src="/MochiKit/Iter.js"></script>
<script type="text/javascript" src="/MochiKit/DOM.js"></script>
<script type="text/javascript" src="/MochiKit/Style.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=364413">Mozilla Bug 364413</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<div id="test1" foobar:foo="foo"/>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 364413 **/
var test1 = document.getElementById("test1");
var attrNode = test1.getAttributeNodeNS("http://www.foobar.com", "foo");
function mutationHandler(aEvent) {
ok(attrNode.isSameNode(aEvent.relatedNode));
ok(aEvent.target == attrNode.ownerElement);
}
function runTest() {
test1.removeAttributeNode(attrNode);
test1.addEventListener("DOMAttrModified", mutationHandler, true);
test1.setAttributeNodeNS(attrNode);
test1.removeEventListener("DOMAttrModified", mutationHandler, true);
}
runTest();
</script>
</pre>
</body>
</html>

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

@ -0,0 +1,48 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=367164
-->
<head>
<title>Test for Bug 367164</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=367164">Mozilla Bug 367164</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 367164 **/
var span = document.createElement("span");
var ins1 = false;
var ins2 = false;
var rem1 = false;
var rem2 = false;
span.addEventListener("DOMNodeInserted", function() { ins1 = true; }, true);
span.addEventListener("DOMNodeInserted", function() { ins2 = true; }, false);
span.addEventListener("DOMNodeRemoved", function() { rem1 = true; }, true);
span.addEventListener("DOMNodeRemoved", function() { rem2 = true; }, false);
$("content").appendChild(span);
$("content").removeChild(span);
is(ins1, true, "Capturing DOMNodeInserted listener");
is(ins2, true, "Bubbling DOMNodeInserted listener");
is(rem1, true, "Capturing DOMNodeRemoved listener");
is(rem2, true, "Bubbling DOMNodeRemoved listener");
</script>
</pre>
</body>
</html>

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

@ -48,6 +48,7 @@ _TEST_FILES = test_bug1682.html \
test_bug1823.html \
test_bug172261.html \
test_bug332848.xhtml \
test_bug359657.html \
$(NULL)
libs:: $(_TEST_FILES)

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

@ -0,0 +1,41 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=359657
-->
<head>
<title>Test for Bug 359657</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=359657">Mozilla Bug 359657</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
SimpleTest.waitForExplicitFinish();
/** Test for Bug 359657 **/
function runTest() {
var span = document.createElement("span");
$("test").insertBefore(span, $("test").firstChild);
ok(true, "Reachability", "We should get here without crashing");
is($("test").firstChild, span, "First child is correct");
SimpleTest.finish();
}
</script>
<div>
<iframe src=""></iframe>
<!-- Important: This test needs to run async at this point. The actual test
is not crashing while running this test! -->
<script type="text/javascript" src="data:text/javascript,runTest()"></script>
</div>
</pre>
</body>
</html>

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

@ -57,16 +57,8 @@ RunSet.runall = function() {
'test_bug345521.html',
'test_bug348497.html',
'test_bug351601.html',
'test_bug359657.html',
'test_bug359754.xul',
'test_bug362391.xhtml',
'test_bug362788.xhtml',
'test_bug364092.xhtml',
'test_bug364413.xhtml',
'test_bug365773.xul',
'test_bug366645.xhtml',
'test_bug367164.html'
'test_bug366645.xhtml'
);
};
RunSet.reloadAndRunAll = function() {

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

@ -45,6 +45,8 @@ include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/rules.mk
_TEST_FILES = test_bug360220.xul \
test_bug359754.xul \
test_bug365773.xul \
$(NULL)
libs:: $(_TEST_FILES)

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

@ -0,0 +1,72 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="/tests/SimpleTest/test.css" type="text/css"?>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=359754
-->
<window title="Mozilla Bug 359754"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml">
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=359754">Mozilla Bug 359754</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
</body>
<description>
Displays a numberbox which ranges from 5 to 10.
</description>
<textbox id="foo" type="number" min="5" max="10"/>
<script class="testbody" type="application/javascript">
function hitIt() {
sendKey("up", "foo");
}
SimpleTest.waitForExplicitFinish();
/** Test for Bug 359754 **/
setTimeout('document.getElementById("foo").focus()', 0);
addLoadEvent(function() {
// pay attention to our key events
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
hitIt();
is($("foo").value, "6", "value is now 6");
hitIt();
is($("foo").value, "7", "value is now 7");
hitIt();
is($("foo").value, "8", "value is now 8");
hitIt();
is($("foo").value, "9", "value is now 9");
// now try to hit it past max
hitIt();
is($("foo").value, "10", "value is now 10");
hitIt();
is($("foo").value, "10", "value is now 10");
hitIt();
is($("foo").value, "10", "value is now 10");
});
addLoadEvent(SimpleTest.finish);
</script>
</window>

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

@ -0,0 +1,70 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="/tests/SimpleTest/test.css" type="text/css"?>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=365773
-->
<window title="Mozilla Bug 365773"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<title>Test for Bug 365773</title>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml">
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=365773">Mozilla Bug 365773</a>
<p id="display">
<radiogroup id="group" collapsed="true" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<radio id="item" label="Item"/>
</radiogroup>
</p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
<script class="testbody" type="application/javascript">
<![CDATA[
/** Test for Bug 365773 **/
function selectItem(item, isIndex, testName) {
var exception = null;
try {
if (isIndex)
document.getElementById("group").selectedIndex = item;
else
document.getElementById("group").selectedItem = item;
}
catch(e) {
exception = e;
}
ok(exception == null, testName);
}
SimpleTest.waitForExplicitFinish();
window.onload = function runTests() {
var item = document.getElementById("item");
selectItem(item, false, "Radio button selected with selectedItem (not focused)");
selectItem(null, false, "Radio button deselected with selectedItem (not focused)");
selectItem(0, true, "Radio button selected with selectedIndex (not focused)");
selectItem(-1, true, "Radio button deselected with selectedIndex (not focused)");
document.getElementById("group").focus();
selectItem(item, false, "Radio button selected with selectedItem (focused)");
selectItem(null, false, "Radio button deselected with selectedItem (focused)");
selectItem(0, true, "Radio button selected with selectedIndex (focused)");
selectItem(-1, true, "Radio button deselected with selectedIndex (focused)");
SimpleTest.finish();
};
]]>
</script>
</window>