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

Unified Diff: third_party/WebKit/LayoutTests/fast/dom/shadow/slotted-pseudo-element-css-text.html

Issue 1523843004: Add support for new CSS ::slotted() pseudo element (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase / fix comments for tests (FYI) 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
Index: third_party/WebKit/LayoutTests/fast/dom/shadow/slotted-pseudo-element-css-text.html
diff --git a/third_party/WebKit/LayoutTests/fast/dom/shadow/slotted-pseudo-element-css-text.html b/third_party/WebKit/LayoutTests/fast/dom/shadow/slotted-pseudo-element-css-text.html
new file mode 100644
index 0000000000000000000000000000000000000000..2d1fd34aa17ec7e9af90f67c7d5c585fc9a69782
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/dom/shadow/slotted-pseudo-element-css-text.html
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<script src='../../../resources/testharness.js'></script>
+<script src='../../../resources/testharnessreport.js'></script>
+<style id="style1">
+.foo::slotted(div) .bar::before { display: block; }
+::slotted { display: block; } /* invalid - no parameter */
+::slotted() { display: block; } /* invalid - empty parameter */
+slot::slotted(div, div) { display: block; } /* invalid - selector list */
+slot::slotted(div div) { display: block; } /* invalid - complex selector (combinator) */
+slot::slotted(.green) { color: green; }
+slot::slotted(#green) { color: green; }
+slot::slotted([green=green]) { color: green; }
+slot::slotted(div.green) { color: green; }
+*::slotted(*) { color: blue; }
+.foo::slotted(*) { color: blue; }
+#id::slotted(*) { color: blue; }
+[attr=foo]::slotted(*) { color: blue; }
+span::slotted(*) { color: blue; } /* never matches, but valid */
+</style>
+<script>
+'use strict';
+test(() => {
+ assert_equals(document.getElementById('style1').sheet.cssRules.item(0).cssText,
+ ".foo::slotted(div) .bar::before { display: block; }");
+ assert_equals(document.getElementById('style1').sheet.cssRules.item(1).cssText,
+ "slot::slotted(.green) { color: green; }");
+ assert_equals(document.getElementById('style1').sheet.cssRules.item(2).cssText,
+ "slot::slotted(#green) { color: green; }");
+ assert_equals(document.getElementById('style1').sheet.cssRules.item(3).cssText,
+ "slot::slotted([green=\"green\"]) { color: green; }");
+ assert_equals(document.getElementById('style1').sheet.cssRules.item(4).cssText,
+ "slot::slotted(div.green) { color: green; }");
+ assert_equals(document.getElementById('style1').sheet.cssRules.item(5).cssText,
+ "*::slotted(*) { color: blue; }");
+ assert_equals(document.getElementById('style1').sheet.cssRules.item(6).cssText,
+ ".foo::slotted(*) { color: blue; }");
+ assert_equals(document.getElementById('style1').sheet.cssRules.item(7).cssText,
+ "#id::slotted(*) { color: blue; }");
+ assert_equals(document.getElementById('style1').sheet.cssRules.item(8).cssText,
+ "[attr=\"foo\"]::slotted(*) { color: blue; }");
+ assert_equals(document.getElementById('style1').sheet.cssRules.item(9).cssText,
+ "span::slotted(*) { color: blue; }");
+}, "Test for cssText of '::slotted' rule.");
+</script>

Powered by Google App Engine
This is Rietveld 408576698