aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMs2ger <ms2ger@gmail.com>2014-08-05 18:00:18 +0200
committerMs2ger <ms2ger@gmail.com>2014-08-05 18:00:18 +0200
commit1d09d324d26273dc1499aa7184e7b20835721b8d (patch)
treec77e71d33022791f6b25698735cd404aafa4ab27
parent40048b791c44a0ef250d09633af38be0a9f257fd (diff)
parent49c4360068cbdb2261bc0e5a4d5139cc1b34f5da (diff)
downloadservo-1d09d324d26273dc1499aa7184e7b20835721b8d.tar.gz
servo-1d09d324d26273dc1499aa7184e7b20835721b8d.zip
Merge pull request #3016 from saneyuki/test
Remove needless tests about document.getElementById() which are covered by wpt; r=Ms2ger
-rw-r--r--src/test/content/test_document_getElementById.html98
-rw-r--r--src/test/content/test_document_getElementById_tree_order.html40
2 files changed, 0 insertions, 138 deletions
diff --git a/src/test/content/test_document_getElementById.html b/src/test/content/test_document_getElementById.html
index 2617fb2e113..d8430011b33 100644
--- a/src/test/content/test_document_getElementById.html
+++ b/src/test/content/test_document_getElementById.html
@@ -8,104 +8,6 @@
<script>
let gBody = document.getElementsByTagName("body")[0];
- // test1: on static page
- {
- let foo = document.getElementById("foo");
- is_not(foo, null, "test-1-0, on static page");
- is(foo && foo.tagName, "HEAD", "test1-1, on static page");
- is_a(foo, HTMLHeadElement, "test1-2, on static page");
-
- let bar = document.getElementById("bar");
- is_not(bar, null, "test1-3, on static page");
- is(bar && bar.tagName, "DIV", "test1-4, on static page");
- is_a(bar, HTMLDivElement, "test1-5, on static page");
- }
-
- // test2: scripted element
- {
- let TEST_ID = "test";
- let test = document.createElement("div");
- test.setAttribute("id", TEST_ID);
- gBody.appendChild(test);
-
- // test: appended element
- let appended = document.getElementById(TEST_ID);
- is_not(appended, null, "test2-0, appended element");
- is(appended && appended.tagName, "DIV", "test2-1, appended element");
- is_a(appended, HTMLDivElement, "test2-2, appended element");
-
- // test: removed element
- gBody.removeChild(test);
- let removed = document.getElementById(TEST_ID);
- // `document.getElementById()` returns `null` if there is none.
- // http://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-getElBId
- // http://dom.spec.whatwg.org/#dom-document-getelementbyid (2013-09-20)
- is(removed, null, "test2-3, removed element");
- }
-
- // test3: update `id` attribute
- {
- // setup fixtures.
- let TEST_ID = "test3";
- let test = document.createElement("div");
- test.setAttribute("id", TEST_ID);
- gBody.appendChild(test);
-
- // update id
- let UPDATED_ID = "test3-updated";
- test.setAttribute("id", UPDATED_ID);
- let e = document.getElementById(UPDATED_ID);
- is(e, test, "test3-0, update 'id' attribute.");
-
- let old = document.getElementById(TEST_ID);
- is(old, null, "test3-1, the method shouldn't get the element by the old id.");
-
- // remove id.
- test.removeAttribute("id");
- let e2 = document.getElementById(UPDATED_ID);
- is(e2, null, "test3-2, the method should return null when the passed id is none in document.");
- }
-
- // test 4
- {
- // Ensure that the id attribute only affects elements present in a document
- let e = document.createElement('div');
- e.id = "should-not-exist";
- is(document.getElementById("should-not-exist"), null, "test 4-0");
- document.body.appendChild(e);
- is(document.getElementById("should-not-exist"), e, "test 4-1");
- }
-
- // test5: "in tree order, within the context object's tree"
- // http://dom.spec.whatwg.org/#dom-document-getelementbyid.
- // we test this in test_document_getElementById_tree_order.html
-
- // TODO:
- // test6: innerHTML
-
- // test 7
- {
- // Test that we only cache elements by ID if they're in a document (see #1874).
- let s = document.createElement("div");
- s.setAttribute("id", "x");
- document.createElement("div").appendChild(s);
- is(document.getElementById("x"), null, "test 7-0");
- }
-
- // test 8
- {
- let TEST_ID = "test-8"
- let element = document.createElement("div");
- element.setAttribute("id", TEST_ID);
- document.body.appendChild(element);
- let target = document.getElementById(TEST_ID);
- is_not(target, null, "test 8-0, getElementById is correct before changing the value");
-
- element.attributes[0].value = TEST_ID + "-updated";
- let target2 = document.getElementById(TEST_ID);
- is(target2, null, "test 8-1, should return null after updated id via Attr.value");
- }
-
// Test the assertion with inserting node with child having id into the document (mozilla#2630)
// This need not to port to WPF-test because this tests servo's internally flags.
{
diff --git a/src/test/content/test_document_getElementById_tree_order.html b/src/test/content/test_document_getElementById_tree_order.html
deleted file mode 100644
index ccf0c37bb01..00000000000
--- a/src/test/content/test_document_getElementById_tree_order.html
+++ /dev/null
@@ -1,40 +0,0 @@
-<html>
- <head>
- <script src="harness.js"></script>
- </head>
- <body>
- <div id="a">
- </div>
- <div id="b">
- <p id="b">P</p>
- <input id="b" type="submit" value="Submit">
- </div>
- <script>
- {
- var b = document.getElementById("b");
- is_a(b, HTMLDivElement);
- var a = document.getElementById("a");
- var p = document.createElement("p");
- p.id = "b";
- a.appendChild(p);
- var newB = document.getElementById("b");
- is_a(newB, HTMLParagraphElement);
- }
- {
- var gbody = document.getElementsByTagName("body")[0];
- var div = document.createElement("div");
- div.setAttribute("id", "c");
- var h1 = document.createElement("h1");
- h1.setAttribute("id", "c");
- gbody.appendChild(div);
- gbody.appendChild(h1);
- var c = document.getElementById("c");
- is_a(c, HTMLDivElement);
- gbody.removeChild(div);
- var newC = document.getElementById("c");
- is_a(newC, HTMLHeadingElement);
- }
- finish();
- </script>
- </body>
-</html>