| Index: third_party/WebKit/LayoutTests/imported/web-platform-tests/html/dom/documents/dom-tree-accessors/Document.body.html
|
| diff --git a/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/dom/documents/dom-tree-accessors/document.body-getter.html b/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/dom/documents/dom-tree-accessors/Document.body.html
|
| similarity index 73%
|
| rename from third_party/WebKit/LayoutTests/imported/web-platform-tests/html/dom/documents/dom-tree-accessors/document.body-getter.html
|
| rename to third_party/WebKit/LayoutTests/imported/web-platform-tests/html/dom/documents/dom-tree-accessors/Document.body.html
|
| index a37ec94e798caf2f5bd52fbca443c0d113932ca5..f06a762069b917473a6a7e0d94458fb7d4f18c12 100644
|
| --- a/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/dom/documents/dom-tree-accessors/document.body-getter.html
|
| +++ b/third_party/WebKit/LayoutTests/imported/web-platform-tests/html/dom/documents/dom-tree-accessors/Document.body.html
|
| @@ -118,4 +118,52 @@ test(function() {
|
| doc.appendChild(doc.createElementNS("http://example.org/test", "frameset"));
|
| assert_equals(doc.body, null);
|
| }, "Non-HTML frameset as the root node");
|
| +
|
| +test(function() {
|
| + assert_not_equals(document.body, null);
|
| + assert_true(document.body instanceof HTMLBodyElement, "should be HTMLBodyElement");
|
| + assert_equals(document.body.tagName, "BODY");
|
| +}, "existing document's body");
|
| +
|
| +
|
| +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.")
|
| +test(function() {
|
| + var doc = document.implementation.createHTMLDocument();
|
| +
|
| + var new_body = doc.createElement("body");
|
| + assert_true(new_body instanceof HTMLBodyElement, "should be HTMLBodyElement");
|
| + assert_equals(new_body.tagName, "BODY");
|
| +
|
| + doc.body = new_body;
|
| + assert_equals(doc.body, new_body);
|
| +}, "Setting document.body to a new body element.");
|
| +test(function() {
|
| + var doc = document.implementation.createHTMLDocument();
|
| +
|
| + var new_frameset = doc.createElement("frameset");
|
| + assert_true(new_frameset instanceof HTMLFrameSetElement, "should be HTMLFrameSetElement");
|
| + assert_equals(new_frameset.tagName, "FRAMESET");
|
| +
|
| + doc.body = new_frameset;
|
| + assert_equals(doc.body, new_frameset, "test6-3, append frameset to a new document");
|
| +}, "Setting document.body to a new frameset element.");
|
| </script>
|
|
|