Bug 1355351: Tests for correct resolution of style for pseudo-elements. r=heycam
MozReview-Commit-ID: BFvXhYCK46v
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -86365,16 +86365,22 @@
]
],
"cssom/StyleSheetList.html": [
[
"/cssom/StyleSheetList.html",
{}
]
],
+ "cssom/getComputedStyle-pseudo.html": [
+ [
+ "/cssom/getComputedStyle-pseudo.html",
+ {}
+ ]
+ ],
"cssom/historical.html": [
[
"/cssom/historical.html",
{}
]
],
"cssom/overflow-serialization.html": [
[
@@ -165012,16 +165018,20 @@
"cssom/MediaList.html": [
"21d9e43514fb3a7fbf8933429242dc544224ef24",
"testharness"
],
"cssom/StyleSheetList.html": [
"3a0e6f64f70f863d679e537c4bfb76aaa0d3598a",
"testharness"
],
+ "cssom/getComputedStyle-pseudo.html": [
+ "6c74e57a2e32a13cc3b7e955a2d89dafdf6d1730",
+ "testharness"
+ ],
"cssom/historical.html": [
"2c78218b89efb9bdf60cf708920be142051347c7",
"testharness"
],
"cssom/overflow-serialization.html": [
"199039706289f577652b968706fc1251398acd1c",
"testharness"
],
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/cssom/getComputedStyle-pseudo.html
@@ -0,0 +1,43 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSSOM: Correct resolution of resolved value for display-affected pseudo-elements</title>
+<link rel="help" href="https://drafts.csswg.org/cssom/#dom-window-getcomputedstyle">
+<link rel="help" href="https://drafts.csswg.org/cssom/#resolved-values">
+<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io">
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<style>
+#test { width: 100px; }
+
+#contents {
+ display: contents;
+ border: 10px solid red;
+}
+
+#test::before,
+#test::after,
+#contents::before,
+#contents::after {
+ content: " ";
+ width: 50%;
+ height: 10px;
+ display: block;
+}
+</style>
+<div id="test">
+ <div id="contents"></div>
+</div>
+<script>
+test(function() {
+ var div = document.getElementById('test');
+ [":before", ":after"].forEach(function(pseudo) {
+ assert_equals(getComputedStyle(div, pseudo).width, "50px");
+ });
+}, "Resolution of width is correct for ::before and ::after pseudo-elements");
+test(function() {
+ var contents = document.getElementById('contents');
+ [":before", ":after"].forEach(function(pseudo) {
+ assert_equals(getComputedStyle(contents, pseudo).width, "50px");
+ });
+}, "Resolution of width is correct for ::before and ::after pseudo-elements of display: contents elements");
+</script>