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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/dom/TreeWalker/resources/TreeWalker-currentNode.js

Issue 1481983002: Drop [LegacyInterfaceTypeChecking] where trivial in core/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more tests Created 5 years 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 unified diff | Download patch
OLDNEW
1 description("Tests the TreeWalker.") 1 description("Tests the TreeWalker.")
2 2
3 var subTree = document.createElement('div'); 3 var subTree = document.createElement('div');
4 subTree.innerHTML = "<p>Lorem ipsum <span>dolor <b>sit</b> amet</span>, consecte tur <i>adipisicing</i> elit, sed do eiusmod <tt>tempor <b><i>incididunt ut</i> l abore</b> et dolore magna</tt> aliqua.</p>" 4 subTree.innerHTML = "<p>Lorem ipsum <span>dolor <b>sit</b> amet</span>, consecte tur <i>adipisicing</i> elit, sed do eiusmod <tt>tempor <b><i>incididunt ut</i> l abore</b> et dolore magna</tt> aliqua.</p>"
5 document.body.appendChild(subTree); 5 document.body.appendChild(subTree);
6 6
7 var all = function(node) { return true; } 7 var all = function(node) { return true; }
8 var w = document.createTreeWalker(subTree, 0x01 | 0x08 | 0x10 | 0x20, all, true) ; 8 var w = document.createTreeWalker(subTree, 0x01 | 0x08 | 0x10 | 0x20, all, true) ;
9 9
10 debug("Test that TreeWalker.parent() doesn't set the currentNode to a node not u nder the root."); 10 debug("Test that TreeWalker.parent() doesn't set the currentNode to a node not u nder the root.");
11 debug(""); 11 debug("");
12 12
13 shouldBe("w.currentNode", "subTree"); 13 shouldBe("w.currentNode", "subTree");
14 shouldBeNull("w.parentNode()"); 14 shouldBeNull("w.parentNode()");
15 shouldBe("w.currentNode", "subTree"); 15 shouldBe("w.currentNode", "subTree");
16 16
17 debug(""); 17 debug("");
18 debug("Test that setting the currentNode to non-Node values throws.");
19 debug("");
20
21 shouldThrow("w.currentNode = null");
22 shouldThrow("w.currentNode = {}");
23 shouldThrow("w.currentNode = window");
24
25 debug("");
18 debug("Test that we handle setting the currentNode to arbitrary nodes not under the root element."); 26 debug("Test that we handle setting the currentNode to arbitrary nodes not under the root element.");
19 debug(""); 27 debug("");
20 28
21 w.currentNode = document.documentElement; 29 w.currentNode = document.documentElement;
22 shouldBeNull("w.parentNode()"); 30 shouldBeNull("w.parentNode()");
23 shouldBe("w.currentNode", "document.documentElement"); 31 shouldBe("w.currentNode", "document.documentElement");
24 w.currentNode = document.documentElement; 32 w.currentNode = document.documentElement;
25 shouldBe("w.nextNode()", "document.documentElement.firstChild"); 33 shouldBe("w.nextNode()", "document.documentElement.firstChild");
26 shouldBe("w.currentNode", "document.documentElement.firstChild"); 34 shouldBe("w.currentNode", "document.documentElement.firstChild");
27 w.currentNode = document.documentElement; 35 w.currentNode = document.documentElement;
(...skipping 16 matching lines...) Expand all
44 debug("Test how we handle the case when the traversed to node within the root, b ut the currentElement is not."); 52 debug("Test how we handle the case when the traversed to node within the root, b ut the currentElement is not.");
45 debug(""); 53 debug("");
46 54
47 w.currentNode = subTree.previousSibling; 55 w.currentNode = subTree.previousSibling;
48 shouldBe("w.nextNode()", "subTree"); 56 shouldBe("w.nextNode()", "subTree");
49 w.currentNode = document.body; 57 w.currentNode = document.body;
50 shouldBe("w.lastChild()", "subTree"); 58 shouldBe("w.lastChild()", "subTree");
51 59
52 // Cleanup 60 // Cleanup
53 document.body.removeChild(subTree); 61 document.body.removeChild(subTree);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698