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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/dom/SelectorAPI/script-tests/viewless-document.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(
2 "This tests that querySelector, querySelectorAll and matchesSelector (webkitMatc hesSelector) don't crash when used in a viewless document."
3 );
4
5 var testDoc = document.implementation.createDocument("http://www.w3.org/1999/xht ml", "html");
6 testDoc.documentElement.appendChild(testDoc.createElement("body"));
7 testDoc.body.appendChild(testDoc.createElement("p")).id = "p1";
8 testDoc.getElementById("p1").appendChild(testDoc.createElement("span")).id = "s1 ";
9 testDoc.body.appendChild(testDoc.createElement("span")).id = "s2";
10 testDoc.body.appendChild(testDoc.createElement("div")).className = "d1";
11
12 var p1 = testDoc.getElementById("p1");
13 var s1 = testDoc.getElementById("s1");
14 var s2 = testDoc.getElementById("s2");
15 var d1 = testDoc.body.lastChild;
16
17 shouldBe("testDoc.querySelector('p')", "p1");
18 shouldBe("testDoc.querySelectorAll('span').length", "2");
19 shouldBe("testDoc.querySelectorAll('span').item(1)", "s2");
20 shouldBe("testDoc.querySelector('.d1')", "d1");
21 shouldBe("testDoc.querySelectorAll('p span').length", "1");
22
23 shouldBeTrue("p1.webkitMatchesSelector('p')");
24 shouldBeTrue("s1.webkitMatchesSelector('p span')");
25 shouldBeTrue("s2.webkitMatchesSelector('#s2')");
26 shouldBeTrue("d1.webkitMatchesSelector('.d1')");
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698