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

Unified Diff: third_party/WebKit/Source/core/dom/SelectorQueryTest.cpp

Issue 1602833002: No pseudo elements in SelectorChecker::Mode QueryingRules. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove-pseudoelm-check-2-20160118
Patch Set: Another review issue Created 4 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
« no previous file with comments | « third_party/WebKit/Source/core/dom/SelectorQuery.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/dom/SelectorQueryTest.cpp
diff --git a/third_party/WebKit/Source/core/dom/SelectorQueryTest.cpp b/third_party/WebKit/Source/core/dom/SelectorQueryTest.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..f49dea77dd57990d0c4bba4aca1081d3fa83cb3e
--- /dev/null
+++ b/third_party/WebKit/Source/core/dom/SelectorQueryTest.cpp
@@ -0,0 +1,32 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "core/dom/SelectorQuery.h"
+
+#include "core/css/parser/CSSParser.h"
+#include "core/dom/Document.h"
+#include "core/html/HTMLHtmlElement.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace blink {
+
+TEST(SelectorQueryTest, NotMatchingPseudoElement)
+{
+ RefPtrWillBeRawPtr<Document> document = Document::create();
+ RefPtrWillBeRawPtr<HTMLHtmlElement> html = HTMLHtmlElement::create(*document);
+ document->appendChild(html.release());
+ document->documentElement()->setInnerHTML("<body><style>span::before { content: 'X' }</style><span></span></body>", ASSERT_NO_EXCEPTION);
+
+ CSSSelectorList selectorList = CSSParser::parseSelector(CSSParserContext(*document, nullptr), nullptr, "span::before");
+ OwnPtr<SelectorQuery> query = SelectorQuery::adopt(std::move(selectorList));
+ RefPtrWillBeRawPtr<Element> elm = query->queryFirst(*document);
+ EXPECT_EQ(nullptr, elm);
+
+ selectorList = CSSParser::parseSelector(CSSParserContext(*document, nullptr), nullptr, "span");
+ query = SelectorQuery::adopt(std::move(selectorList));
+ elm = query->queryFirst(*document);
+ EXPECT_NE(nullptr, elm);
+}
+
+} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/dom/SelectorQuery.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698