| Index: third_party/WebKit/Source/core/css/resolver/SharedStyleFinderTest.cpp
|
| diff --git a/third_party/WebKit/Source/core/css/resolver/SharedStyleFinderTest.cpp b/third_party/WebKit/Source/core/css/resolver/SharedStyleFinderTest.cpp
|
| index f5ff6bd5f6ae5d23b0ef3075ae774e921827dfe9..497d6db681e3287f6d0e169cadfed9442c9b2d6c 100644
|
| --- a/third_party/WebKit/Source/core/css/resolver/SharedStyleFinderTest.cpp
|
| +++ b/third_party/WebKit/Source/core/css/resolver/SharedStyleFinderTest.cpp
|
| @@ -9,6 +9,8 @@
|
| #include "core/css/parser/CSSParser.h"
|
| #include "core/css/parser/CSSParserContext.h"
|
| #include "core/dom/Document.h"
|
| +#include "core/dom/shadow/ShadowRoot.h"
|
| +#include "core/dom/shadow/ShadowRootInit.h"
|
| #include "core/frame/FrameView.h"
|
| #include "core/html/HTMLElement.h"
|
| #include "core/testing/DummyPageHolder.h"
|
| @@ -29,6 +31,16 @@ class SharedStyleFinderTest : public ::testing::Test {
|
| document().view()->updateAllLifecyclePhases();
|
| }
|
|
|
| + ShadowRoot& attachShadow(Element& host) {
|
| + ShadowRootInit init;
|
| + init.setMode("open");
|
| + ShadowRoot* shadowRoot =
|
| + host.attachShadow(ScriptState::forMainWorld(document().frame()), init,
|
| + ASSERT_NO_EXCEPTION);
|
| + EXPECT_TRUE(shadowRoot);
|
| + return *shadowRoot;
|
| + }
|
| +
|
| void addSelector(const String& selector) {
|
| StyleRuleBase* newRule =
|
| CSSParser::parseRule(CSSParserContext(HTMLStandardMode, nullptr),
|
| @@ -182,4 +194,24 @@ TEST_F(SharedStyleFinderTest, AttributeAffectedByDrag) {
|
| EXPECT_FALSE(matchesUncommonAttributeRuleSet(*b));
|
| }
|
|
|
| +TEST_F(SharedStyleFinderTest, SlottedPseudoWithAttribute) {
|
| + setBodyContent("<div id=host><div id=a></div><div id=b attr></div></div>");
|
| + Element* host = document().getElementById("host");
|
| + ShadowRoot& root = attachShadow(*host);
|
| + root.setInnerHTML("<slot></slot>");
|
| + document().updateDistribution();
|
| +
|
| + addSelector("::slotted([attr])");
|
| + finishAddingSelectors();
|
| +
|
| + Element* a = document().getElementById("a");
|
| + Element* b = document().getElementById("b");
|
| +
|
| + EXPECT_TRUE(a->assignedSlot());
|
| + EXPECT_TRUE(b->assignedSlot());
|
| +
|
| + EXPECT_FALSE(matchesUncommonAttributeRuleSet(*a));
|
| + EXPECT_TRUE(matchesUncommonAttributeRuleSet(*b));
|
| +}
|
| +
|
| } // namespace blink
|
|
|