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

Unified Diff: third_party/WebKit/LayoutTests/fast/dom/SelectorAPI/id-fastpath.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/SelectorAPI/id-fastpath.html
diff --git a/third_party/WebKit/LayoutTests/fast/dom/SelectorAPI/id-fastpath.html b/third_party/WebKit/LayoutTests/fast/dom/SelectorAPI/id-fastpath.html
index 40f8c4767ce2d8cf9051659bac3a5705c709d558..db578ff27def1f2239792f37b258b9b1fad79ced 100644
--- a/third_party/WebKit/LayoutTests/fast/dom/SelectorAPI/id-fastpath.html
+++ b/third_party/WebKit/LayoutTests/fast/dom/SelectorAPI/id-fastpath.html
@@ -4,6 +4,32 @@
<script src="../../../resources/js-test.js"></script>
</head>
<body>
-<script src="script-tests/id-fastpath.js"></script>
+<script>
+description(
+"This tests that the querySelector and querySelectorAll fast path for IDs is not overzelous."
+);
+
+var root = document.createElement('div');
+var correctNode = document.createElement('div');
+correctNode.setAttribute("id", "testid")
+root.appendChild(correctNode);
+document.body.appendChild(root);
+
+shouldBe("document.querySelector('div#testid')", "correctNode");
+shouldBe("document.querySelector('#testid')", "correctNode");
+shouldBeNull("document.querySelector('ul#testid')");
+shouldBeNull("document.querySelector('ul #testid')");
+shouldBeNull("document.querySelector('#testid[attr]')");
+shouldBeNull("document.querySelector('#testid:not(div)')");
+
+shouldBe("document.querySelectorAll('div#testid').length", "1");
+shouldBe("document.querySelectorAll('div#testid').item(0)", "correctNode");
+shouldBe("document.querySelectorAll('#testid').length", "1");
+shouldBe("document.querySelectorAll('#testid').item(0)", "correctNode");
+shouldBe("document.querySelectorAll('ul#testid').length", "0");
+shouldBe("document.querySelectorAll('ul #testid').length", "0");
+shouldBe("document.querySelectorAll('#testid[attr]').length", "0");
+shouldBe("document.querySelectorAll('#testid:not(div)').length", "0");
+</script>
</body>
</html>

Powered by Google App Engine
This is Rietveld 408576698