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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/dom/Element/script-tests/element-traversal.js

Issue 2667393002: Stop using script-tests in fast/dom/. (Closed)
Patch Set: . Created 3 years, 10 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 unified diff | Download patch
OLDNEW
(Empty)
1 description("This test checks the implementation of the ElementTraversal API.");
2
3 debug('Test with no children');
4 var noChildren = document.createElement('div');
5
6 shouldBe("noChildren.firstElementChild", "null");
7 shouldBe("noChildren.lastElementChild", "null");
8 shouldBe("noChildren.previousElementSibling", "null");
9 shouldBe("noChildren.nextElementSibling", "null");
10 shouldBe("noChildren.childElementCount", "0");
11
12 debug('Test with no element children');
13 var noElementChildren = document.createElement('div');
14 noElementChildren.appendChild(document.createComment("comment but not an element "));
15 noElementChildren.appendChild(document.createTextNode("no elements here"));
16
17 shouldBe("noElementChildren.firstElementChild", "null");
18 shouldBe("noElementChildren.lastElementChild", "null");
19 shouldBe("noElementChildren.previousElementSibling", "null");
20 shouldBe("noElementChildren.nextElementSibling", "null");
21 shouldBe("noElementChildren.childElementCount", "0");
22
23 debug('Test with elements');
24 var children = document.createElement('div');
25 children.appendChild(document.createComment("first comment"));
26 var first = document.createElement('p');
27 children.appendChild(first);
28 children.appendChild(document.createComment("a comment"));
29 var last = document.createElement('p');
30 children.appendChild(last);
31 children.appendChild(document.createComment("last comment"));
32
33 shouldBe("children.firstElementChild", "first");
34 shouldBe("children.lastElementChild", "last");
35 shouldBe("first.nextElementSibling", "last");
36 shouldBe("first.nextElementSibling.nextElementSibling", "null");
37 shouldBe("last.previousElementSibling", "first");
38 shouldBe("last.previousElementSibling.previousElementSibling", "null");
39 shouldBe("children.childElementCount", "2");
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698