Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(484)

Unified Diff: third_party/WebKit/LayoutTests/fast/dom/Element/element-traversal.html

Issue 2667393002: Stop using script-tests in fast/dom/. (Closed)
Patch Set: . Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/fast/dom/Element/element-traversal.html
diff --git a/third_party/WebKit/LayoutTests/fast/dom/Element/element-traversal.html b/third_party/WebKit/LayoutTests/fast/dom/Element/element-traversal.html
index 8384a1e5ab265e99de4fa3fb45bf37f18090492a..180d4220359f97a77d07524c0755e4973ad389dc 100644
--- a/third_party/WebKit/LayoutTests/fast/dom/Element/element-traversal.html
+++ b/third_party/WebKit/LayoutTests/fast/dom/Element/element-traversal.html
@@ -4,6 +4,46 @@
<script src="../../../resources/js-test.js"></script>
</head>
<body>
-<script src="script-tests/element-traversal.js"></script>
+<script>
+description("This test checks the implementation of the ElementTraversal API.");
+
+debug('Test with no children');
+var noChildren = document.createElement('div');
+
+shouldBe("noChildren.firstElementChild", "null");
+shouldBe("noChildren.lastElementChild", "null");
+shouldBe("noChildren.previousElementSibling", "null");
+shouldBe("noChildren.nextElementSibling", "null");
+shouldBe("noChildren.childElementCount", "0");
+
+debug('Test with no element children');
+var noElementChildren = document.createElement('div');
+noElementChildren.appendChild(document.createComment("comment but not an element"));
+noElementChildren.appendChild(document.createTextNode("no elements here"));
+
+shouldBe("noElementChildren.firstElementChild", "null");
+shouldBe("noElementChildren.lastElementChild", "null");
+shouldBe("noElementChildren.previousElementSibling", "null");
+shouldBe("noElementChildren.nextElementSibling", "null");
+shouldBe("noElementChildren.childElementCount", "0");
+
+debug('Test with elements');
+var children = document.createElement('div');
+children.appendChild(document.createComment("first comment"));
+var first = document.createElement('p');
+children.appendChild(first);
+children.appendChild(document.createComment("a comment"));
+var last = document.createElement('p');
+children.appendChild(last);
+children.appendChild(document.createComment("last comment"));
+
+shouldBe("children.firstElementChild", "first");
+shouldBe("children.lastElementChild", "last");
+shouldBe("first.nextElementSibling", "last");
+shouldBe("first.nextElementSibling.nextElementSibling", "null");
+shouldBe("last.previousElementSibling", "first");
+shouldBe("last.previousElementSibling.previousElementSibling", "null");
+shouldBe("children.childElementCount", "2");
+</script>
</body>
</html>

Powered by Google App Engine
This is Rietveld 408576698