mirror of
https://github.com/servo/servo.git
synced 2025-08-20 21:05:34 +01:00
Update web-platform-tests to revision dc5cbf088edcdb266541d4e5a76149a2c6e716a0
This commit is contained in:
parent
1d40075f03
commit
079092dfea
2381 changed files with 90360 additions and 17722 deletions
|
@ -15,6 +15,17 @@ var htmlNamespace = "http://www.w3.org/1999/xhtml"
|
|||
var svgNamespace = "http://www.w3.org/2000/svg"
|
||||
var mathMLNamespace = "http://www.w3.org/1998/Math/MathML"
|
||||
|
||||
// Make DocumentTypes distinct
|
||||
function my_format_value(val) {
|
||||
if (val instanceof DocumentType) {
|
||||
return "DocumentType node <!DOCTYPE " + val.name
|
||||
+ (val.publicId ? " " + val.publicId : "")
|
||||
+ (val.systemId ? " " + val.systemId : "")
|
||||
+ ">";
|
||||
}
|
||||
return format_value(val);
|
||||
}
|
||||
|
||||
test(function() {
|
||||
var tests = createElementNS_tests.map(function(t) {
|
||||
return [t[0], t[1], null, t[2]]
|
||||
|
@ -44,17 +55,17 @@ test(function() {
|
|||
[null, null, document.implementation.createDocumentType("foo", "", ""), null],
|
||||
[null, null, document.doctype, null], // This causes a horrible WebKit bug (now fixed in trunk).
|
||||
[null, null, function() {
|
||||
var foo = document.implementation.createDocumentType("foo", "", "");
|
||||
var foo = document.implementation.createDocumentType("bar", "", "");
|
||||
document.implementation.createDocument(null, null, foo);
|
||||
return foo;
|
||||
}(), null], // DOCTYPE already associated with a document.
|
||||
[null, null, function() {
|
||||
var bar = document.implementation.createDocument(null, null, null);
|
||||
return bar.implementation.createDocumentType("bar", "", "");
|
||||
return bar.implementation.createDocumentType("baz", "", "");
|
||||
}(), null], // DOCTYPE created by a different implementation.
|
||||
[null, null, function() {
|
||||
var bar = document.implementation.createDocument(null, null, null);
|
||||
var magic = bar.implementation.createDocumentType("bar", "", "");
|
||||
var magic = bar.implementation.createDocumentType("quz", "", "");
|
||||
bar.implementation.createDocument(null, null, magic);
|
||||
return magic;
|
||||
}(), null], // DOCTYPE created by a different implementation and already associated with a document.
|
||||
|
@ -116,7 +127,7 @@ test(function() {
|
|||
}
|
||||
assert_equals(doc.childNodes.length, !omitRootElement + !!doctype)
|
||||
}
|
||||
}, "createDocument test " + i + ": " + t.map(function(el) { return format_value(el) }))
|
||||
}, "createDocument test: " + t.map(my_format_value))
|
||||
|
||||
if (expected === null) {
|
||||
test(function() {
|
||||
|
@ -130,7 +141,7 @@ test(function() {
|
|||
assert_equals(doc.documentURI, "about:blank")
|
||||
assert_equals(doc.createElement("DIV").localName, "DIV");
|
||||
}, "createDocument test " + i + ": metadata for " +
|
||||
[namespace, qualifiedName, doctype].map(function(el) { return format_value(el) }))
|
||||
[namespace, qualifiedName, doctype].map(my_format_value))
|
||||
|
||||
test(function() {
|
||||
var doc = document.implementation.createDocument(namespace, qualifiedName, doctype)
|
||||
|
@ -138,7 +149,7 @@ test(function() {
|
|||
assert_equals(doc.charset, "UTF-8", "charset");
|
||||
assert_equals(doc.inputEncoding, "UTF-8", "inputEncoding");
|
||||
}, "createDocument test " + i + ": characterSet aliases for " +
|
||||
[namespace, qualifiedName, doctype].map(function(el) { return format_value(el) }))
|
||||
[namespace, qualifiedName, doctype].map(my_format_value))
|
||||
}
|
||||
})
|
||||
})
|
||||
|
|
|
@ -8,6 +8,12 @@
|
|||
<script>
|
||||
test(function() {
|
||||
var tests = [
|
||||
[],
|
||||
["Core"],
|
||||
["XML"],
|
||||
["org.w3c.svg"],
|
||||
["org.w3c.dom.svg"],
|
||||
["http://www.w3.org/TR/SVG11/feature#Script"],
|
||||
["Core", "1.0"],
|
||||
["Core", "2.0"],
|
||||
["Core", "3.0"],
|
||||
|
@ -131,11 +137,19 @@ test(function() {
|
|||
["This is filler text.", ""],
|
||||
[null, ""],
|
||||
[undefined, ""],
|
||||
["org.w3c.svg", ""],
|
||||
["org.w3c.svg", "1.0"],
|
||||
["org.w3c.svg", "1.1"],
|
||||
["org.w3c.dom.svg", ""],
|
||||
["org.w3c.dom.svg", "1.0"],
|
||||
["org.w3c.dom.svg", "1.1"],
|
||||
["http://www.w3.org/TR/SVG11/feature#Script", "7.5"],
|
||||
];
|
||||
tests.forEach(function(data) {
|
||||
test(function() {
|
||||
assert_equals(document.implementation.hasFeature(data[0], data[1]), true)
|
||||
}, "hasFeature(" + format_value(data[0]) + ", " + format_value(data[1]) + ")")
|
||||
assert_equals(document.implementation.hasFeature
|
||||
.apply(document.implementation, data), true)
|
||||
}, "hasFeature(" + data.map(format_value).join(", ") + ")")
|
||||
})
|
||||
})
|
||||
</script>
|
||||
|
|
|
@ -162,17 +162,17 @@ function test_getElementsByTagName(context, element) {
|
|||
test(function() {
|
||||
var t = element.appendChild(document.createElementNS("http://www.w3.org/1999/xhtml", "test:aÇ"))
|
||||
this.add_cleanup(function() {element.removeChild(t)})
|
||||
assert_array_equals(context.getElementsByTagName("AÇ"), [t], "All uppercase input")
|
||||
assert_array_equals(context.getElementsByTagName("aÇ"), [t], "Ascii lowercase input")
|
||||
assert_array_equals(context.getElementsByTagName("aç"), [], "All lowercase input")
|
||||
assert_array_equals(context.getElementsByTagName("TEST:AÇ"), [t], "All uppercase input")
|
||||
assert_array_equals(context.getElementsByTagName("test:aÇ"), [t], "Ascii lowercase input")
|
||||
assert_array_equals(context.getElementsByTagName("test:aç"), [], "All lowercase input")
|
||||
}, "Element in HTML namespace, prefix, non-ascii characters in name")
|
||||
|
||||
test(function() {
|
||||
var t = element.appendChild(document.createElementNS("test", "test:AÇ"))
|
||||
var t = element.appendChild(document.createElementNS("test", "TEST:AÇ"))
|
||||
this.add_cleanup(function() {element.removeChild(t)})
|
||||
assert_array_equals(context.getElementsByTagName("AÇ"), [t], "All uppercase input")
|
||||
assert_array_equals(context.getElementsByTagName("aÇ"), [], "Ascii lowercase input")
|
||||
assert_array_equals(context.getElementsByTagName("aç"), [], "All lowercase input")
|
||||
assert_array_equals(context.getElementsByTagName("TEST:AÇ"), [t], "All uppercase input")
|
||||
assert_array_equals(context.getElementsByTagName("test:aÇ"), [], "Ascii lowercase input")
|
||||
assert_array_equals(context.getElementsByTagName("test:aç"), [], "All lowercase input")
|
||||
}, "Element in non-HTML namespace, prefix, non-ascii characters in name")
|
||||
|
||||
test(function() {
|
||||
|
|
|
@ -18,7 +18,6 @@ test(function() {
|
|||
[null, null, null],
|
||||
[null, "", "INVALID_CHARACTER_ERR"],
|
||||
[undefined, null, null],
|
||||
[undefined, undefined, null],
|
||||
[undefined, "", "INVALID_CHARACTER_ERR"],
|
||||
["http://example.com/", null, null],
|
||||
["http://example.com/", "", "INVALID_CHARACTER_ERR"],
|
||||
|
@ -56,7 +55,7 @@ test(function() {
|
|||
assert_equals(element.nodeName, qualified)
|
||||
assert_equals(element.namespaceURI, namespace === undefined ? null : namespace)
|
||||
}
|
||||
}, "createElementNS test " + i + ": " + t.map(function(el) { return format_value(el) }))
|
||||
}, "createElementNS test: " + t.map(format_value))
|
||||
})
|
||||
})
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@ var createElementNS_tests = [
|
|||
[null, "1foo", "INVALID_CHARACTER_ERR"],
|
||||
[null, "f1oo", null],
|
||||
[null, "foo1", null],
|
||||
[null, "1foo", "INVALID_CHARACTER_ERR"],
|
||||
[null, "\u0300foo", "INVALID_CHARACTER_ERR"],
|
||||
[null, "}foo", "INVALID_CHARACTER_ERR"],
|
||||
[null, "f}oo", "INVALID_CHARACTER_ERR"],
|
||||
|
@ -66,7 +65,6 @@ var createElementNS_tests = [
|
|||
["http://example.com/", "ns0:test", null],
|
||||
["http://example.com/", "a.b:c", null],
|
||||
["http://example.com/", "a-b:c", null],
|
||||
["http://example.com/", "a-b:c", null],
|
||||
["http://example.com/", "xml", null],
|
||||
["http://example.com/", "xmlns", "NAMESPACE_ERR"],
|
||||
["http://example.com/", "XMLNS", null],
|
||||
|
|
|
@ -71,17 +71,17 @@ test(function() {
|
|||
test(function() {
|
||||
var t = document.body.appendChild(document.createElementNS("http://www.w3.org/1999/xhtml", "test:aÇ"))
|
||||
this.add_cleanup(function() {document.body.removeChild(t)})
|
||||
assert_array_equals(document.getElementsByTagName("AÇ"), [], "All uppercase input")
|
||||
assert_array_equals(document.getElementsByTagName("aÇ"), [t], "Ascii lowercase input")
|
||||
assert_array_equals(document.getElementsByTagName("aç"), [], "All lowercase input")
|
||||
assert_array_equals(document.getElementsByTagName("TEST:AÇ"), [], "All uppercase input")
|
||||
assert_array_equals(document.getElementsByTagName("test:aÇ"), [t], "Ascii lowercase input")
|
||||
assert_array_equals(document.getElementsByTagName("test:aç"), [], "All lowercase input")
|
||||
}, "Element in HTML namespace, prefix, non-ascii characters in name")
|
||||
|
||||
test(function() {
|
||||
var t = document.body.appendChild(document.createElementNS("test", "test:AÇ"))
|
||||
var t = document.body.appendChild(document.createElementNS("test", "TEST:AÇ"))
|
||||
this.add_cleanup(function() {document.body.removeChild(t)})
|
||||
assert_array_equals(document.getElementsByTagName("AÇ"), [t], "All uppercase input")
|
||||
assert_array_equals(document.getElementsByTagName("aÇ"), [], "Ascii lowercase input")
|
||||
assert_array_equals(document.getElementsByTagName("aç"), [], "All lowercase input")
|
||||
assert_array_equals(document.getElementsByTagName("TEST:AÇ"), [t], "All uppercase input")
|
||||
assert_array_equals(document.getElementsByTagName("test:aÇ"), [], "Ascii lowercase input")
|
||||
assert_array_equals(document.getElementsByTagName("test:aç"), [], "All lowercase input")
|
||||
}, "Element in non-HTML namespace, prefix, non-ascii characters in name")
|
||||
|
||||
test(function() {
|
||||
|
|
|
@ -45,4 +45,53 @@ test(function() {
|
|||
test(function() {
|
||||
check_parent_node(new Document());
|
||||
}, "Node.childNodes on a Document.");
|
||||
|
||||
test(function() {
|
||||
var node = document.createElement("div");
|
||||
var kid1 = document.createElement("p");
|
||||
var kid2 = document.createTextNode("hey");
|
||||
var kid3 = document.createElement("span");
|
||||
node.appendChild(kid1);
|
||||
node.appendChild(kid2);
|
||||
node.appendChild(kid3);
|
||||
|
||||
var list = node.childNodes;
|
||||
assert_array_equals([...list], [kid1, kid2, kid3]);
|
||||
|
||||
var keys = list.keys();
|
||||
assert_false(keys instanceof Array);
|
||||
keys = [...keys];
|
||||
assert_array_equals(keys, [0, 1, 2]);
|
||||
|
||||
var values = list.values();
|
||||
assert_false(values instanceof Array);
|
||||
values = [...values];
|
||||
assert_array_equals(values, [kid1, kid2, kid3]);
|
||||
|
||||
var entries = list.entries();
|
||||
assert_false(entries instanceof Array);
|
||||
entries = [...entries];
|
||||
assert_equals(entries.length, keys.length);
|
||||
assert_equals(entries.length, values.length);
|
||||
for (var i = 0; i < entries.length; ++i) {
|
||||
assert_array_equals(entries[i], [keys[i], values[i]]);
|
||||
}
|
||||
|
||||
var cur = 0;
|
||||
var thisObj = {};
|
||||
list.forEach(function(value, key, listObj) {
|
||||
assert_equals(listObj, list);
|
||||
assert_equals(this, thisObj);
|
||||
assert_equals(value, values[cur]);
|
||||
assert_equals(key, keys[cur]);
|
||||
cur++;
|
||||
}, thisObj);
|
||||
assert_equals(cur, entries.length);
|
||||
|
||||
assert_equals(list[Symbol.iterator], Array.prototype[Symbol.iterator]);
|
||||
assert_equals(list.keys, Array.prototype.keys);
|
||||
assert_equals(list.values, Array.prototype.values);
|
||||
assert_equals(list.entries, Array.prototype.entries);
|
||||
assert_equals(list.forEach, Array.prototype.forEach);
|
||||
}, "Iterator behavior of Node.childNodes");
|
||||
</script>
|
||||
|
|
|
@ -226,7 +226,7 @@ var expected = {
|
|||
textContent: "do re mi fa so la ti",
|
||||
|
||||
// Element
|
||||
namespaceURI: "http://www.w3.org/1999/xhtml",
|
||||
namespaceURI: null,
|
||||
prefix: null,
|
||||
localName: "igiveuponcreativenames",
|
||||
tagName: "igiveuponcreativenames",
|
||||
|
@ -246,7 +246,7 @@ var expected = {
|
|||
textContent: "",
|
||||
|
||||
// Element
|
||||
namespaceURI: "http://www.w3.org/1999/xhtml",
|
||||
namespaceURI: null,
|
||||
prefix: null,
|
||||
localName: "everyone-hates-hyphenated-element-names",
|
||||
tagName: "everyone-hates-hyphenated-element-names",
|
||||
|
|
|
@ -20,23 +20,6 @@
|
|||
var XML = "http://www.w3.org/XML/1998/namespace"
|
||||
var XMLNS = "http://www.w3.org/2000/xmlns/"
|
||||
|
||||
// AttrExodus
|
||||
test(function() {
|
||||
document.body.setAttribute("abc", "pass")
|
||||
var attr = document.body.attributes[0]
|
||||
assert_true(attr instanceof Attr, "should be an Attr")
|
||||
assert_false(attr instanceof Node, "should not be a Node")
|
||||
var removed_members = [
|
||||
"appendChild",
|
||||
"insertBefore",
|
||||
"childNodes",
|
||||
]
|
||||
removed_members.forEach(function(m) {
|
||||
assert_false(m in attr, m + " should not be supported")
|
||||
})
|
||||
assert_equals(attr.value, "pass")
|
||||
}, "AttrExodus")
|
||||
|
||||
// setAttribute exhaustive tests
|
||||
// Step 1
|
||||
test(function() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue