diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:47:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:47:29 +0000 |
commit | 0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d (patch) | |
tree | a31f07c9bcca9d56ce61e9a1ffd30ef350d513aa /testing/web-platform/tests/css/css-shadow-parts/interaction-with-pseudo-elements.html | |
parent | Initial commit. (diff) | |
download | firefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.tar.xz firefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.zip |
Adding upstream version 115.8.0esr.upstream/115.8.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/css/css-shadow-parts/interaction-with-pseudo-elements.html')
-rw-r--r-- | testing/web-platform/tests/css/css-shadow-parts/interaction-with-pseudo-elements.html | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/testing/web-platform/tests/css/css-shadow-parts/interaction-with-pseudo-elements.html b/testing/web-platform/tests/css/css-shadow-parts/interaction-with-pseudo-elements.html new file mode 100644 index 0000000000..776ab2eb69 --- /dev/null +++ b/testing/web-platform/tests/css/css-shadow-parts/interaction-with-pseudo-elements.html @@ -0,0 +1,86 @@ +<!DOCTYPE html> +<html> + <head> + <title>CSS Shadow Parts - Interaction with pseudo-elements</title> + <meta href="mailto:fergal@chromium.org" rel="author" title="Fergal Daly"> + <link href="http://www.google.com/" rel="author" title="Google"> + <link href="https://drafts.csswg.org/css-shadow-parts/" rel="help"> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <script src="support/shadow-helper.js"></script> + </head> + <body> + <style> + #c-e::part(before-p)::before { color: green; } + #c-e::part(after-p)::after { color: green; } + #c-e::part(placeholder-p)::placeholder { color: green; } + #c-e::part(selection-p)::selection { color: green; } + #c-e::part(first-line-p)::first-line { color: green; } + #c-e::part(first-letter-p)::first-letter { color: green; } + </style> + <script>installCustomElement("custom-element", "custom-element-template");</script> + <template id="custom-element-template"> + <style> + #before-i::before { content: "this text"; color: red; } + #after-i::after { content: "this text"; color: red; } + #placeholder-i::placeholder { color: red; } + #selection-i::selection { color: red; } + #first-line-i::first-line { color: red; } + #first-letter-i::first-letter { color: red; } + </style> + <div> + The following text should be green: + <span id="before-i" part="before-p"></span> + </div> + <div> + The following text should be green: + <span id="after-i" part="after-p"></span> + </div> + <div> + The following text should be green: + <input id="placeholder-i" part="placeholder-p" placeholder="this text"></input> + </div> + <div> + The selected text should be green: + <div id="selection-i" part="selection-p">select some text</div> + </div> + <div> + The following text should be green: + <div id="first-line-i" part="first-line-p">this text<br>Not this</div> + </div> + <div> + The first letter should be green: + <div id="first-letter-i" part="first-letter-p"><p>this text</p></div> + </div> + </template> + <custom-element id="c-e"></custom-element> + <script> + "use strict"; + const colorGreen = "rgb(0, 128, 0)"; + test(function() { + const el = getElementByShadowIds(document, ["c-e", "before-i"]); + assert_equals(window.getComputedStyle(el, '::before').color, colorGreen); + }, "::before in selected host is styled"); + test(function() { + const el = getElementByShadowIds(document, ["c-e", "after-i"]); + assert_equals(window.getComputedStyle(el, '::after').color, colorGreen); + }, "::after in selected host is styled"); + test(function() { + const el = getElementByShadowIds(document, ["c-e", "placeholder-i"]); + assert_equals(window.getComputedStyle(el, '::placeholder').color, colorGreen); + }, "::placeholder in selected host is styled"); + test(function() { + const el = getElementByShadowIds(document, ["c-e", "selection-i"]); + assert_equals(window.getComputedStyle(el, '::selection').color, colorGreen); + }, "::selection in selected host is styled"); + test(function() { + const el = getElementByShadowIds(document, ["c-e", "first-line-i"]); + assert_equals(window.getComputedStyle(el, '::first-line').color, colorGreen); + }, "::first-line in selected host is styled"); + test(function() { + const el = getElementByShadowIds(document, ["c-e", "first-letter-i"]); + assert_equals(window.getComputedStyle(el, '::first-letter').color, colorGreen); + }, "::first-letter in selected host is styled"); + </script> + </body> +</html> |