Bug 1355351: Tests for correct resolution of style for pseudo-elements. r?heycam draft
authorEmilio Cobos Álvarez <emilio@crisal.io>
Sun, 16 Apr 2017 23:29:46 +0200
changeset 567672 aeaeba25ce570bac66ffc6d334439e00e9a96978
parent 567671 c535482625e345c254102ba68e7815770ad2d7aa
child 567673 bed8884fce650b148ad19b39141189fa728a2ec0
push id55660
push userbmo:emilio+bugs@crisal.io
push dateTue, 25 Apr 2017 11:34:52 +0000
reviewersheycam
bugs1355351
milestone55.0a1
Bug 1355351: Tests for correct resolution of style for pseudo-elements. r?heycam MozReview-Commit-ID: BFvXhYCK46v
testing/web-platform/meta/MANIFEST.json
testing/web-platform/tests/cssom/getComputedStyle-pseudo.html
--- 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>