OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "core/dom/SelectorQuery.h" |
| 6 |
| 7 #include "core/css/parser/CSSParser.h" |
| 8 #include "core/dom/Document.h" |
| 9 #include "core/html/HTMLHtmlElement.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" |
| 11 |
| 12 namespace blink { |
| 13 |
| 14 TEST(SelectorQueryTest, NotMatchingPseudoElement) |
| 15 { |
| 16 RefPtrWillBeRawPtr<Document> document = Document::create(); |
| 17 RefPtrWillBeRawPtr<HTMLHtmlElement> html = HTMLHtmlElement::create(*document
); |
| 18 document->appendChild(html.release()); |
| 19 document->documentElement()->setInnerHTML("<body><style>span::before { conte
nt: 'X' }</style><span></span></body>", ASSERT_NO_EXCEPTION); |
| 20 |
| 21 CSSSelectorList selectorList = CSSParser::parseSelector(CSSParserContext(*do
cument, nullptr), nullptr, "span::before"); |
| 22 OwnPtr<SelectorQuery> query = SelectorQuery::adopt(std::move(selectorList)); |
| 23 RefPtrWillBeRawPtr<Element> elm = query->queryFirst(*document); |
| 24 EXPECT_EQ(nullptr, elm); |
| 25 |
| 26 selectorList = CSSParser::parseSelector(CSSParserContext(*document, nullptr)
, nullptr, "span"); |
| 27 query = SelectorQuery::adopt(std::move(selectorList)); |
| 28 elm = query->queryFirst(*document); |
| 29 EXPECT_NE(nullptr, elm); |
| 30 } |
| 31 |
| 32 } // namespace blink |
OLD | NEW |