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

Unified Diff: third_party/WebKit/LayoutTests/fast/dom/TreeWalker/traversal-skip-most.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/TreeWalker/traversal-skip-most.html
diff --git a/third_party/WebKit/LayoutTests/fast/dom/TreeWalker/traversal-skip-most.html b/third_party/WebKit/LayoutTests/fast/dom/TreeWalker/traversal-skip-most.html
index 5eabebe6df632d37d4404b971c8b14166da07ae2..1e4c8c2b880c0d550eb52b15de3013c6d6a92a2b 100644
--- a/third_party/WebKit/LayoutTests/fast/dom/TreeWalker/traversal-skip-most.html
+++ b/third_party/WebKit/LayoutTests/fast/dom/TreeWalker/traversal-skip-most.html
@@ -1,9 +1,34 @@
-<!DOCTYPE html>
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../../resources/js-test.js"></script>
</head>
<body>
-<script src="script-tests/traversal-skip-most.js"></script>
+<script>
+description('Test TreeWalker with skipping');
+
+var walker;
+var testElement = document.createElement("div");
+testElement.innerHTML='<div id="A1"><div id="B1" class="keep"></div><div id="B2">this text matters</div><div id="B3" class="keep"></div></div>';
+
+var filter = {
+ acceptNode: function(node) {
+ if (node.className == 'keep')
+ return NodeFilter.FILTER_ACCEPT;
+
+ return NodeFilter.FILTER_SKIP;
+ }
+}
+
+debug("<br>Testing nextSibling")
+walker = document.createTreeWalker(testElement, NodeFilter.SHOW_ELEMENT, filter, false);
+shouldBe("walker.firstChild(); walker.currentNode.id", "'B1'");
+shouldBe("walker.nextSibling(); walker.currentNode.id", "'B3'");
+
+debug("<br>Testing previousSibling")
+walker = document.createTreeWalker(testElement, NodeFilter.SHOW_ELEMENT, filter, false);
+walker.currentNode = testElement.querySelectorAll('#B3')[0];
+shouldBe("walker.previousSibling(); walker.currentNode.id", "'B1'");
+</script>
</body>
</html>

Powered by Google App Engine
This is Rietveld 408576698