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

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

Issue 1565263003: Implement CSS parser part for ::slotted pseudo element (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase, fix layout test. 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 | « no previous file | third_party/WebKit/Source/core/css/CSSSelector.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..d0a014797bd68148055ff73ebccff239b255e291
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/dom/shadow/slotted-pseudo-element-css-text.html
@@ -0,0 +1,65 @@
+<!DOCTYPE html>
+<script src='../../../resources/testharness.js'></script>
+<script src='../../../resources/testharnessreport.js'></script>
+<style id="style1">
+::slotted { display: block; } /* invalid - no parameter */
+::slotted() { display: block; } /* invalid - empty parameter */
+::slotted(*) { display: block; }
+*::slotted(*) { display: block; }
+::slotted(div) { display: block; } /* expects universal selector (*) on the left in cssText */
+::slotted( div) { display: block; } /* allow a space on left */
+::slotted(div ) { display: block; } /* allow a space on right */
+::slotted(div::before) { display: block; } /* having a pseudo element in () is invalid */
+
+.foo::slotted(div) { color: blue; }
+#id::slotted(*) { color: blue; }
+[attr=foo]::slotted(*) { color: blue; }
+.foo .bar::slotted(div) { color: blue; }
+.foo::before .bar::slotted(div) { color: blue; } /* invalid, only one pseudo element is allowed at the rightmost compound */
+.foo::slotted(div) .bar { color: blue; } /* invalid, same as above */
+::slotted(div, div) { color: blue; } /* invalid - selector list */
+::slotted(div div) { color: blue; } /* invalid - complex selector (combinator is used) */
+
+slot::slotted(.green) { color: green; }
+slot::slotted(#green) { color: green; }
+slot::slotted([green=green]) { color: green; }
+slot::slotted(div.green) { color: green; }
+
+div ::slotted(div) { color: red; }
+div + slot::slotted(div) { color: red; }
+
+span::slotted(*) { color: red; } /* never matches, but valid as a selector */
+::slotted(span)::slotted(span) { color: red; } /* invalid */
+::slotted(::slotted(div)) { color: red; } /* invalid */
+</style>
+<script>
+'use strict';
+test(() => {
+ var style1 = document.getElementById('style1');
+ var cssRules = style1.sheet.cssRules;
+
+ var expectedCSSTexts = [
+ "::slotted(*) { display: block; }",
+ "*::slotted(*) { display: block; }",
+ "::slotted(div) { display: block; }",
+ "::slotted(div) { display: block; }",
+ "::slotted(div) { display: block; }",
+ ".foo::slotted(div) { color: blue; }",
+ "#id::slotted(*) { color: blue; }",
+ "[attr=\"foo\"]::slotted(*) { color: blue; }",
+ ".foo .bar::slotted(div) { color: blue; }",
+ "slot::slotted(.green) { color: green; }",
+ "slot::slotted(#green) { color: green; }",
+ "slot::slotted([green=\"green\"]) { color: green; }",
+ "slot::slotted(div.green) { color: green; }",
+ "div ::slotted(div) { color: red; }",
+ "div + slot::slotted(div) { color: red; }",
+ "span::slotted(*) { color: red; }"
+ ];
+
+ for (var i = 0; i < expectedCSSTexts.length; ++i)
+ assert_equals(cssRules.item(i).cssText, expectedCSSTexts[i]);
+ assert_equals(cssRules.length, expectedCSSTexts.length);
+
+}, "Test for cssText of '::slotted' rule.");
+</script>
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/css/CSSSelector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698