aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMs2ger <Ms2ger@gmail.com>2016-04-29 09:56:38 +0200
committerMs2ger <Ms2ger@gmail.com>2016-04-29 10:38:26 +0200
commitcfe2c6b5049aec01274011a5f848bff1d09307a8 (patch)
tree001196580f6ad13d4fbe2e047d4ec9e27f558d83
parent78ae9a5da0f8f3dc67c2d0a76507a54bd08b9fba (diff)
downloadservo-cfe2c6b5049aec01274011a5f848bff1d09307a8.tar.gz
servo-cfe2c6b5049aec01274011a5f848bff1d09307a8.zip
Merge existing wpt Document::body tests.
-rw-r--r--tests/wpt/metadata/MANIFEST.json13
-rw-r--r--tests/wpt/web-platform-tests/html/dom/documents/dom-tree-accessors/Document.body.html (renamed from tests/wpt/web-platform-tests/html/dom/documents/dom-tree-accessors/document.body-getter.html)22
-rw-r--r--tests/wpt/web-platform-tests/html/dom/documents/dom-tree-accessors/document.body-setter-01.html31
3 files changed, 34 insertions, 32 deletions
diff --git a/tests/wpt/metadata/MANIFEST.json b/tests/wpt/metadata/MANIFEST.json
index eba0da0ecf0..4fbeada837c 100644
--- a/tests/wpt/metadata/MANIFEST.json
+++ b/tests/wpt/metadata/MANIFEST.json
@@ -35238,7 +35238,10 @@
"wdspec": []
},
"local_changes": {
- "deleted": [],
+ "deleted": [
+ "html/dom/documents/dom-tree-accessors/document.body-getter.html",
+ "html/dom/documents/dom-tree-accessors/document.body-setter-01.html"
+ ],
"deleted_reftests": {},
"items": {
"reftest": {
@@ -35254,6 +35257,14 @@
"url": "/html/rendering/replaced-elements/embedded-content-rendering-rules/canvas_without_context_a.html"
}
]
+ },
+ "testharness": {
+ "html/dom/documents/dom-tree-accessors/Document.body.html": [
+ {
+ "path": "html/dom/documents/dom-tree-accessors/Document.body.html",
+ "url": "/html/dom/documents/dom-tree-accessors/Document.body.html"
+ }
+ ]
}
},
"reftest_nodes": {
diff --git a/tests/wpt/web-platform-tests/html/dom/documents/dom-tree-accessors/document.body-getter.html b/tests/wpt/web-platform-tests/html/dom/documents/dom-tree-accessors/Document.body.html
index 90ca7e59a03..150ab50bee1 100644
--- a/tests/wpt/web-platform-tests/html/dom/documents/dom-tree-accessors/document.body-getter.html
+++ b/tests/wpt/web-platform-tests/html/dom/documents/dom-tree-accessors/Document.body.html
@@ -118,4 +118,26 @@ test(function() {
doc.appendChild(doc.createElementNS("http://example.org/test", "frameset"));
assert_equals(doc.body, null);
}, "Non-HTML frameset as the root node");
+
+
+var originalBody = document.body;
+test(function() {
+ assert_throws(new TypeError(), function() {
+ document.body = "text"
+ })
+ assert_equals(document.body, originalBody);
+}, "Setting document.body to a string.")
+test(function() {
+ assert_throws("HierarchyRequestError", function() {
+ document.body = document.createElement("div")
+ })
+ assert_equals(document.body, originalBody);
+}, "Setting document.body to a div element.")
+test(function() {
+ var doc = createDocument();
+ assert_throws("HierarchyRequestError", function() {
+ doc.body = doc.createElement("body")
+ })
+ assert_equals(doc.body, null);
+}, "Setting document.body when there's no root element.")
</script>
diff --git a/tests/wpt/web-platform-tests/html/dom/documents/dom-tree-accessors/document.body-setter-01.html b/tests/wpt/web-platform-tests/html/dom/documents/dom-tree-accessors/document.body-setter-01.html
deleted file mode 100644
index f3a1638116c..00000000000
--- a/tests/wpt/web-platform-tests/html/dom/documents/dom-tree-accessors/document.body-setter-01.html
+++ /dev/null
@@ -1,31 +0,0 @@
-<!DOCTYPE html>
-<title>Setting document.body to incorrect values</title>
-<link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com">
-<link rel="help" href="https://html.spec.whatwg.org/multipage/#dom-document-body">
-<link rel="help" href="https://heycam.github.io/webidl/#es-interface">
-<script src="/resources/testharness.js"></script>
-<script src="/resources/testharnessreport.js"></script>
-<div id="log"></div>
-<script>
-var originalBody = document.body;
-test(function() {
- assert_throws(new TypeError(), function() {
- document.body = "text"
- })
-}, "Should throw a TypeError when trying to set document.body to a string.")
-test(function() {
- assert_throws("HierarchyRequestError", function() {
- document.body = document.createElement("div")
- })
-}, "Should throw a HierarchyRequestError when trying to set document.body to a div element.")
-test(function() {
- var doc = document.implementation.createHTMLDocument("")
- doc.removeChild(doc.documentElement)
- assert_throws("HierarchyRequestError", function() {
- doc.body = document.createElement("body")
- })
-}, "Should throw a HierarchyRequestError when trying to set document.body when there's no root element.")
-test(function() {
- assert_equals(document.body, originalBody);
-}, "document.body has not changed")
-</script>