Index: Source/core/dom/DocumentTest.cpp |
diff --git a/Source/core/dom/DocumentTest.cpp b/Source/core/dom/DocumentTest.cpp |
index 76f953ff806ec168d4c964eeb4ebec6393433272..6cf14d3437a471a5fa88f45e1dfe78406bee296a 100644 |
--- a/Source/core/dom/DocumentTest.cpp |
+++ b/Source/core/dom/DocumentTest.cpp |
@@ -324,4 +324,33 @@ TEST_F(DocumentTest, OutgoingReferrerWithUniqueOrigin) |
EXPECT_EQ(String(), document().outgoingReferrer()); |
} |
+TEST_F(DocumentTest, StyleVersion) |
+{ |
+ setHtmlInnerHTML( |
+ "<style>" |
+ " .a * { color: green }" |
+ " .b .c { color: green }" |
+ "</style>" |
+ "<div id='x'><span class='c'></span></div>"); |
+ |
+ Element* element = document().getElementById("x"); |
+ EXPECT_TRUE(element); |
+ |
+ uint64_t previousStyleVersion = document().styleVersion(); |
+ element->setAttribute(blink::HTMLNames::classAttr, "notfound"); |
+ EXPECT_EQ(previousStyleVersion, document().styleVersion()); |
+ |
+ document().view()->updateAllLifecyclePhases(); |
+ |
+ previousStyleVersion = document().styleVersion(); |
+ element->setAttribute(blink::HTMLNames::classAttr, "a"); |
+ EXPECT_NE(previousStyleVersion, document().styleVersion()); |
+ |
+ document().view()->updateAllLifecyclePhases(); |
+ |
+ previousStyleVersion = document().styleVersion(); |
+ element->setAttribute(blink::HTMLNames::classAttr, "a b"); |
+ EXPECT_NE(previousStyleVersion, document().styleVersion()); |
+} |
+ |
} // namespace blink |