Update web-platform-tests to revision d011702f368b88b3bae86e7a8fd2ddd22e18b33c

This commit is contained in:
Ms2ger 2016-04-12 09:07:41 +02:00
parent f9608022ca
commit 299ad0f9d0
573 changed files with 38776 additions and 14942 deletions

View file

@ -127,17 +127,19 @@ function test_getElementsByTagName(context, element) {
test(function() {
var t = element.appendChild(document.createElementNS("test", "te:st"))
this.add_cleanup(function() {element.removeChild(t)})
assert_array_equals(context.getElementsByTagName("st"), [t])
assert_array_equals(context.getElementsByTagName("st"), [])
assert_array_equals(context.getElementsByTagName("ST"), [])
assert_array_equals(context.getElementsByTagName("te:st"), [t])
assert_array_equals(context.getElementsByTagName("te:ST"), [])
}, "Element in non-HTML namespace, prefix, lowercase name")
test(function() {
var t = element.appendChild(document.createElementNS("test", "te:ST"))
this.add_cleanup(function() {element.removeChild(t)})
assert_array_equals(context.getElementsByTagName("ST"), [t])
assert_array_equals(context.getElementsByTagName("st"), [])
assert_array_equals(context.getElementsByTagName("ST"), [])
assert_array_equals(context.getElementsByTagName("te:st"), [])
assert_array_equals(context.getElementsByTagName("te:ST"), [])
assert_array_equals(context.getElementsByTagName("te:ST"), [t])
}, "Element in non-HTML namespace, prefix, uppercase name")
test(function() {

View file

@ -37,17 +37,19 @@ test(function() {
test(function() {
var t = document.body.appendChild(document.createElementNS("test", "te:st"))
this.add_cleanup(function() {document.body.removeChild(t)})
assert_array_equals(document.getElementsByTagName("st"), [t])
assert_array_equals(document.getElementsByTagName("st"), [])
assert_array_equals(document.getElementsByTagName("ST"), [])
assert_array_equals(document.getElementsByTagName("te:st"), [t])
assert_array_equals(document.getElementsByTagName("te:ST"), [])
}, "Element in non-HTML namespace, prefix, lowercase name")
test(function() {
var t = document.body.appendChild(document.createElementNS("test", "te:ST"))
this.add_cleanup(function() {document.body.removeChild(t)})
assert_array_equals(document.getElementsByTagName("ST"), [t])
assert_array_equals(document.getElementsByTagName("ST"), [])
assert_array_equals(document.getElementsByTagName("st"), [])
assert_array_equals(document.getElementsByTagName("te:st"), [])
assert_array_equals(document.getElementsByTagName("te:ST"), [])
assert_array_equals(document.getElementsByTagName("te:ST"), [t])
}, "Element in non-HTML namespace, prefix, uppercase name")
test(function() {

View file

@ -66,8 +66,8 @@ test(function () {
assert_equals( elem.classList.toString(), ' ', 'explicit' );
}, 'classList should contain initial markup whitespace');
test(function () {
assert_throws( 'SYNTAX_ERR', function () { elem.classList.contains(''); } );
}, '.contains(empty_string) must throw a SYNTAX_ERR');
assert_false( elem.classList.contains('') );
}, '.contains(empty_string) must return false');
test(function () {
assert_throws( 'SYNTAX_ERR', function () { elem.classList.add(''); } );
}, '.add(empty_string) must throw a SYNTAX_ERR');
@ -85,8 +85,8 @@ test(function () {
assert_throws( 'SYNTAX_ERR', function () { elem.classList.replace('', ''); } );
}, '.replace with empty_string must throw a SYNTAX_ERR');
test(function () {
assert_throws( 'INVALID_CHARACTER_ERR', function () { elem.classList.contains('a b'); } );
}, '.contains(string_with_spaces) must throw an INVALID_CHARACTER_ERR');
assert_false( elem.classList.contains('a b') );
}, '.contains(string_with_spaces) must return false');
test(function () {
assert_throws( 'INVALID_CHARACTER_ERR', function () { elem.classList.add('a b'); } );
}, '.add(string_with_spaces) must throw an INVALID_CHARACTER_ERR');

View file

@ -0,0 +1,91 @@
<!doctype html>
<meta charset=utf-8>
<title></title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<div id="target"></div>
<div id="parent"><span id=target2></span></div>
<div id="log" style="visibility:visible"></div>
<span id="test1"></span>
<span id="test2"></span>
<span id="test3"></span>
<span id="test4"></span>
<script>
var target = document.getElementById("target");
var target2 = document.getElementById("target2");
test(function() {
assert_throws("SyntaxError", function() {
target.insertAdjacentElement("test", document.getElementById("test1"))
});
assert_throws("SyntaxError", function() {
target2.insertAdjacentElement("test", document.getElementById("test1"))
});
}, "Inserting to an invalid location should cause a Syntax Error exception")
test(function() {
var el = target.insertAdjacentElement("beforebegin", document.getElementById("test1"));
assert_equals(target.previousSibling.id, "test1");
assert_equals(el.id, "test1");
el = target2.insertAdjacentElement("beforebegin", document.getElementById("test1"));
assert_equals(target2.previousSibling.id, "test1");
assert_equals(el.id, "test1");
}, "Inserted element should be target element's previous sibling for 'beforebegin' case")
test(function() {
var el = target.insertAdjacentElement("afterbegin", document.getElementById("test2"));
assert_equals(target.firstChild.id, "test2");
assert_equals(el.id, "test2");
el = target2.insertAdjacentElement("afterbegin", document.getElementById("test2"));
assert_equals(target2.firstChild.id, "test2");
assert_equals(el.id, "test2");
}, "Inserted element should be target element's first child for 'afterbegin' case")
test(function() {
var el = target.insertAdjacentElement("beforeend", document.getElementById("test3"));
assert_equals(target.lastChild.id, "test3");
assert_equals(el.id, "test3");
el = target2.insertAdjacentElement("beforeend", document.getElementById("test3"));
assert_equals(target2.lastChild.id, "test3");
assert_equals(el.id, "test3");
}, "Inserted element should be target element's last child for 'beforeend' case")
test(function() {
var el = target.insertAdjacentElement("afterend", document.getElementById("test4"));
assert_equals(target.nextSibling.id, "test4");
assert_equals(el.id, "test4");
el = target2.insertAdjacentElement("afterend", document.getElementById("test4"));
assert_equals(target2.nextSibling.id, "test4");
assert_equals(el.id, "test4");
}, "Inserted element should be target element's next sibling for 'afterend' case")
test(function() {
var docElement = document.documentElement;
docElement.style.visibility="hidden";
assert_throws("HierarchyRequestError", function() {
var el = docElement.insertAdjacentElement("beforebegin", document.getElementById("test1"));
assert_equals(el, null);
});
var el = docElement.insertAdjacentElement("afterbegin", document.getElementById("test2"));
assert_equals(docElement.firstChild.id, "test2");
assert_equals(el.id, "test2");
el = docElement.insertAdjacentElement("beforeend", document.getElementById("test3"));
assert_equals(docElement.lastChild.id, "test3");
assert_equals(el.id, "test3");
assert_throws("HierarchyRequestError", function() {
var el = docElement.insertAdjacentElement("afterend", document.getElementById("test4"));
assert_equals(el, null);
});
}, "Adding more than one child to document should cause a HierarchyRequestError exception")
</script>

View file

@ -0,0 +1,76 @@
<!doctype html>
<meta charset=utf-8>
<title></title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<body style="visibility:hidden">
<div id="target"></div>
<div id="parent"><span id=target2></span></div>
<div id="log" style="visibility:visible"></div>
</body>
<script>
var target = document.getElementById("target");
var target2 = document.getElementById("target2");
test(function() {
assert_throws("SyntaxError", function() {
target.insertAdjacentText("test", "text")
});
assert_throws("SyntaxError", function() {
target2.insertAdjacentText("test", "test")
});
}, "Inserting to an invalid location should cause a Syntax Error exception")
test(function() {
target.insertAdjacentText("beforebegin", "test1");
assert_equals(target.previousSibling.nodeValue, "test1");
target2.insertAdjacentText("beforebegin", "test1");
assert_equals(target2.previousSibling.nodeValue, "test1");
}, "Inserted text node should be target element's previous sibling for 'beforebegin' case")
test(function() {
target.insertAdjacentText("afterbegin", "test2");
assert_equals(target.firstChild.nodeValue, "test2");
target2.insertAdjacentText("afterbegin", "test2");
assert_equals(target2.firstChild.nodeValue, "test2");
}, "Inserted text node should be target element's first child for 'afterbegin' case")
test(function() {
target.insertAdjacentText("beforeend", "test3");
assert_equals(target.lastChild.nodeValue, "test3");
target2.insertAdjacentText("beforeend", "test3");
assert_equals(target2.lastChild.nodeValue, "test3");
}, "Inserted text node should be target element's last child for 'beforeend' case")
test(function() {
target.insertAdjacentText("afterend", "test4");
assert_equals(target.nextSibling.nodeValue, "test4");
target2.insertAdjacentText("afterend", "test4");
assert_equals(target.nextSibling.nodeValue, "test4");
}, "Inserted text node should be target element's next sibling for 'afterend' case")
test(function() {
var docElement = document.documentElement;
docElement.style.visibility="hidden";
assert_throws("HierarchyRequestError", function() {
docElement.insertAdjacentText("beforebegin", "text1")
});
docElement.insertAdjacentText("afterbegin", "test2");
assert_equals(docElement.firstChild.nodeValue, "test2");
docElement.insertAdjacentText("beforeend", "test3");
assert_equals(docElement.lastChild.nodeValue, "test3");
assert_throws("HierarchyRequestError", function() {
docElement.insertAdjacentText("afterend", "test4")
});
}, "Adding more than one child to document should cause a HierarchyRequestError exception")
</script>

View file

@ -73,6 +73,13 @@ function ascii_lowercase(input) {
});
}
function get_qualified_name(el) {
if (el.prefix) {
return el.prefix + ":" + el.localName;
}
return el.localName;
}
function test_create_element(name) {
var node = document.createElement(name);
assert_equals(node.localName, expected_case(name));
@ -133,9 +140,9 @@ function test_get_elements_tag_name(elements_to_create, search_string) {
var expected = Array.prototype.filter.call(container.childNodes,
function(node) {
if (is_html && node.namespaceURI === "http://www.w3.org/1999/xhtml") {
return node.localName === expected_case(search_string);
return get_qualified_name(node) === expected_case(search_string);
} else {
return node.localName === search_string;
return get_qualified_name(node) === search_string;
}
});
document.documentElement.appendChild(container);

View file

@ -0,0 +1,18 @@
<!doctype html>
<meta charset=utf-8>
<title></title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<div id="testDiv" onclick="result1 = remove; result2 = this.remove;"></div>
<script>
var remove = "Hello there";
var result1;
var result2;
test(function() {
assert_true(Element.prototype[Symbol.unscopables].remove);
var div = document.querySelector("#testDiv");
div.dispatchEvent(new Event("click"));
assert_equals(typeof result1, "string");
assert_equals(typeof result2, "function");
}, "remove() should be unscopable")
</script>