Bug 881077 - Update html tests; r=mounir

This commit is contained in:
Ms2ger 2013-06-23 09:14:51 +02:00
parent 21e2701dae
commit 41c8fbc796
6 changed files with 188 additions and 6 deletions

View File

@ -1,6 +1,7 @@
{
"Frameset followed by body inside the html element": true,
"Body followed by frameset inside a non-HTML html element": true,
"Frameset followed by body inside a non-HTML html element": true,
"Frameset inside an x element followed by a frameset": true,
"Frameset as the root node": true,
"Body as the root node with a frameset child": true,

View File

@ -10,6 +10,7 @@ relativesrcdir := @relativesrcdir@
include $(DEPTH)/config/autoconf.mk
MOCHITEST_FILES := \
test_createTBody.html.json \
test_table-insertRow.html.json \
test_table-rows.html.json \
$(NULL)

View File

@ -0,0 +1,16 @@
{
"No child nodes": true,
"One tbody child node": true,
"Two tbody child nodes": true,
"A thead and a tbody child node": true,
"A tfoot and a tbody child node": true,
"A tbody and a thead child node": true,
"A tbody and a tfoot child node": true,
"Two tbody child nodes and a div": true,
"One HTML and one namespaced tbody child node": true,
"Two nested tbody child nodes": true,
"A tbody node inside a thead child node": true,
"A tbody node inside a tfoot child node": true,
"A tbody node inside a thead child node after a tbody child node": true,
"A tbody node inside a tfoot child node after a tbody child node": true
}

View File

@ -42,19 +42,17 @@ test(function() {
var doc = createDocument();
var html =
doc.appendChild(doc.createElementNS("http://example.org/test", "html"));
var b =
html.appendChild(doc.createElement("body"));
html.appendChild(doc.createElement("frameset"));
assert_equals(doc.body, b);
assert_equals(doc.body, null);
}, "Body followed by frameset inside a non-HTML html element");
test(function() {
var doc = createDocument();
var html =
doc.appendChild(doc.createElementNS("http://example.org/test", "html"));
var f =
html.appendChild(doc.createElement("frameset"));
html.appendChild(doc.createElement("body"));
assert_equals(doc.body, f);
assert_equals(doc.body, null);
}, "Frameset followed by body inside a non-HTML html element");
test(function() {
var doc = createDocument();

View File

@ -10,6 +10,7 @@ relativesrcdir := @relativesrcdir@
include $(DEPTH)/config/autoconf.mk
MOCHITEST_FILES := \
test_createTBody.html \
test_insertRow-method-01.html \
test_insertRow-method-02.html \
test_table-insertRow.html \

View File

@ -0,0 +1,165 @@
<!doctype html>
<meta charset=utf-8>
<title>HTMLTableElement.createTBody</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<div id=log></div>
<script>
function assert_tbody(tbody) {
assert_equals(tbody.localName, "tbody");
assert_equals(tbody.namespaceURI, htmlNS);
assert_equals(tbody.prefix, null);
}
var htmlNS = "http://www.w3.org/1999/xhtml";
test(function() {
var table = document.createElement("table");
var tbody = table.createTBody();
assert_equals(table.firstChild, tbody);
assert_tbody(tbody);
}, "No child nodes");
test(function() {
var table = document.createElement("table");
var before = table.appendChild(document.createElement("tbody"));
assert_array_equals(table.childNodes, [before]);
var tbody = table.createTBody();
assert_array_equals(table.childNodes, [before, tbody]);
assert_tbody(tbody);
}, "One tbody child node");
test(function() {
var table = document.createElement("table");
var before1 = table.appendChild(document.createElement("tbody"));
var before2 = table.appendChild(document.createElement("tbody"));
assert_array_equals(table.childNodes, [before1, before2]);
var tbody = table.createTBody();
assert_array_equals(table.childNodes, [before1, before2, tbody]);
assert_tbody(tbody);
}, "Two tbody child nodes");
test(function() {
var table = document.createElement("table");
var before1 = table.appendChild(document.createElement("thead"));
var before2 = table.appendChild(document.createElement("tbody"));
assert_array_equals(table.childNodes, [before1, before2]);
var tbody = table.createTBody();
assert_array_equals(table.childNodes, [before1, before2, tbody]);
assert_tbody(tbody);
}, "A thead and a tbody child node");
test(function() {
var table = document.createElement("table");
var before1 = table.appendChild(document.createElement("tfoot"));
var before2 = table.appendChild(document.createElement("tbody"));
assert_array_equals(table.childNodes, [before1, before2]);
var tbody = table.createTBody();
assert_array_equals(table.childNodes, [before1, before2, tbody]);
assert_tbody(tbody);
}, "A tfoot and a tbody child node");
test(function() {
var table = document.createElement("table");
var before = table.appendChild(document.createElement("tbody"));
var after = table.appendChild(document.createElement("thead"));
assert_array_equals(table.childNodes, [before, after]);
var tbody = table.createTBody();
assert_array_equals(table.childNodes, [before, tbody, after]);
assert_tbody(tbody);
}, "A tbody and a thead child node");
test(function() {
var table = document.createElement("table");
var before = table.appendChild(document.createElement("tbody"));
var after = table.appendChild(document.createElement("tfoot"));
assert_array_equals(table.childNodes, [before, after]);
var tbody = table.createTBody();
assert_array_equals(table.childNodes, [before, tbody, after]);
assert_tbody(tbody);
}, "A tbody and a tfoot child node");
test(function() {
var table = document.createElement("table");
var before1 = table.appendChild(document.createElement("tbody"));
var before2 = table.appendChild(document.createElement("tbody"));
var after = table.appendChild(document.createElement("div"));
assert_array_equals(table.childNodes, [before1, before2, after]);
var tbody = table.createTBody();
assert_array_equals(table.childNodes, [before1, before2, tbody, after]);
assert_tbody(tbody);
}, "Two tbody child nodes and a div");
test(function() {
var table = document.createElement("table");
var before = table.appendChild(document.createElement("tbody"));
var after = table.appendChild(document.createElementNS("x", "tbody"));
assert_array_equals(table.childNodes, [before, after]);
var tbody = table.createTBody();
assert_array_equals(table.childNodes, [before, tbody, after]);
assert_tbody(tbody);
}, "One HTML and one namespaced tbody child node");
test(function() {
var table = document.createElement("table");
var before1 = table.appendChild(document.createElement("tbody"));
var before2 = before1.appendChild(document.createElement("tbody"));
assert_array_equals(table.childNodes, [before1]);
var tbody = table.createTBody();
assert_array_equals(table.childNodes, [before1, tbody]);
assert_tbody(tbody);
}, "Two nested tbody child nodes");
test(function() {
var table = document.createElement("table");
var before1 = table.appendChild(document.createElement("thead"));
var before2 = before1.appendChild(document.createElement("tbody"));
assert_array_equals(table.childNodes, [before1]);
var tbody = table.createTBody();
assert_array_equals(table.childNodes, [before1, tbody]);
assert_tbody(tbody);
}, "A tbody node inside a thead child node");
test(function() {
var table = document.createElement("table");
var before1 = table.appendChild(document.createElement("tfoot"));
var before2 = before1.appendChild(document.createElement("tbody"));
assert_array_equals(table.childNodes, [before1]);
var tbody = table.createTBody();
assert_array_equals(table.childNodes, [before1, tbody]);
assert_tbody(tbody);
}, "A tbody node inside a tfoot child node");
test(function() {
var table = document.createElement("table");
var before = table.appendChild(document.createElement("tbody"));
var after1 = table.appendChild(document.createElement("thead"));
var after2 = after1.appendChild(document.createElement("tbody"));
assert_array_equals(table.childNodes, [before, after1]);
var tbody = table.createTBody();
assert_array_equals(table.childNodes, [before, tbody, after1]);
assert_tbody(tbody);
}, "A tbody node inside a thead child node after a tbody child node");
test(function() {
var table = document.createElement("table");
var before = table.appendChild(document.createElement("tbody"));
var after1 = table.appendChild(document.createElement("tfoot"));
var after2 = after1.appendChild(document.createElement("tbody"));
assert_array_equals(table.childNodes, [before, after1]);
var tbody = table.createTBody();
assert_array_equals(table.childNodes, [before, tbody, after1]);
assert_tbody(tbody);
}, "A tbody node inside a tfoot child node after a tbody child node");
</script>