Title: [250862] trunk/LayoutTests
Revision
250862
Author
[email protected]
Date
2019-10-08 14:40:52 -0700 (Tue, 08 Oct 2019)

Log Message

[CSS Shadow Parts] Add test for exportparts list syntax
https://bugs.webkit.org/show_bug.cgi?id=202695

Reviewed by Ryosuke Niwa.

The test shows that we don't handle exporting same part under multiple names correctly.

* fast/css/shadow-parts/exportparts-syntax-expected.txt: Added.
* fast/css/shadow-parts/exportparts-syntax.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (250861 => 250862)


--- trunk/LayoutTests/ChangeLog	2019-10-08 21:40:25 UTC (rev 250861)
+++ trunk/LayoutTests/ChangeLog	2019-10-08 21:40:52 UTC (rev 250862)
@@ -1,5 +1,17 @@
 2019-10-08  Antti Koivisto  <[email protected]>
 
+        [CSS Shadow Parts] Add test for exportparts list syntax
+        https://bugs.webkit.org/show_bug.cgi?id=202695
+
+        Reviewed by Ryosuke Niwa.
+
+        The test shows that we don't handle exporting same part under multiple names correctly.
+
+        * fast/css/shadow-parts/exportparts-syntax-expected.txt: Added.
+        * fast/css/shadow-parts/exportparts-syntax.html: Added.
+
+2019-10-08  Antti Koivisto  <[email protected]>
+
         [CSS Shadow Parts] Fix style invalidation with class selector and ::before and ::after
         https://bugs.webkit.org/show_bug.cgi?id=202694
 

Added: trunk/LayoutTests/fast/css/shadow-parts/exportparts-syntax-expected.txt (0 => 250862)


--- trunk/LayoutTests/fast/css/shadow-parts/exportparts-syntax-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/css/shadow-parts/exportparts-syntax-expected.txt	2019-10-08 21:40:52 UTC (rev 250862)
@@ -0,0 +1,8 @@
+The following text should be green:
+
+PASS Shortcut notation 
+PASS Full notation 
+PASS Skip bad entries 
+PASS Mapping multiple parts to a single export 
+FAIL Multiple exports for a single part assert_equals: expected "rgb(0, 128, 0)" but got "rgb(0, 0, 255)"
+

Added: trunk/LayoutTests/fast/css/shadow-parts/exportparts-syntax.html (0 => 250862)


--- trunk/LayoutTests/fast/css/shadow-parts/exportparts-syntax.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/shadow-parts/exportparts-syntax.html	2019-10-08 21:40:52 UTC (rev 250862)
@@ -0,0 +1,76 @@
+<!DOCTYPE html>
+<html>
+  <head>
+    <title>CSS Shadow Parts - exportparts list syntax</title>
+    <link href="" rel="author" title="Apple">
+    <link href="" rel="help">
+    <script src=""
+    <script src=""
+    <script src=""
+  </head>
+  <body>
+    <style>
+      ::part(part1) { color: green; }
+      ::part(export-part2) { color: green; }
+      ::part(export-part3-good) { color: green; }
+      ::part(export-part3-error) { color: blue; }
+      ::part(export-part4-part5) { color: green; }
+      ::part(export-part4-part5) { color: green; }
+      ::part(export-part6-name1) { color: blue; }
+      ::part(export-part6-name2) { color: green; }
+      ::part(export-part6-name1)::before { color: green; }
+      ::part(export-part6-name2)::after { color: green; }
+    </style>
+    <script>installCustomElement("custom-element-inner", "custom-element-inner-template");</script>
+    <template id="custom-element-inner-template">
+      <style>
+        span { color: red; }
+        #part6::before { content: "(before "; color: red; }
+        #part6::after { content: " after)"; color: red; }
+      </style>
+      <span id="part1" part="part1">Part 1</span>
+      <span id="part2" part="part2">Part 2</span>
+      <span id="part3" part="part3">Part 3</span>
+      <span id="part4" part="part4">Part 4</span>
+      <span id="part5" part="part5">Part 5</span>
+      <span id="part6" part="part6">Part 6</span>
+    </template>
+    <script>installCustomElement("custom-element-outer", "custom-element-outer-template");</script>
+    <template id="custom-element-outer-template">
+        <custom-element-inner id="c-e-inner" exportparts="part1, part2:export-part2,part3:export-part3-error:,,
+            ,:, : ,: :,part3:export-part3-good,part4:export-part4-part5, part5:export-part4-part5, part6:export-part6-name1, part6:export-part6-name2"></custom-element-inner>
+    </template>
+    The following text should be green:
+    <div id="target">
+        <div><custom-element-outer id="c-e-outer"></custom-element-outer></div>
+    </div>
+    <script>
+      "use strict";
+      const colorGreen = "rgb(0, 128, 0)";
+      test(function() {
+        const part = getElementByShadowIds(document, ["c-e-outer", "c-e-inner", "part1"]);
+        assert_equals(window.getComputedStyle(part).color, colorGreen);
+      }, "Shortcut notation");
+      test(function() {
+        const part = getElementByShadowIds(document, ["c-e-outer", "c-e-inner", "part2"]);
+        assert_equals(window.getComputedStyle(part).color, colorGreen);
+      }, "Full notation");
+      test(function() {
+        const part = getElementByShadowIds(document, ["c-e-outer", "c-e-inner", "part3"]);
+        assert_equals(window.getComputedStyle(part).color, colorGreen);
+      }, "Skip bad entries");
+      test(function() {
+        const part1 = getElementByShadowIds(document, ["c-e-outer", "c-e-inner", "part4"]);
+        assert_equals(window.getComputedStyle(part1).color, colorGreen);
+        const part2 = getElementByShadowIds(document, ["c-e-outer", "c-e-inner", "part5"]);
+        assert_equals(window.getComputedStyle(part2).color, colorGreen);
+      }, "Mapping multiple parts to a single export");
+      test(function() {
+        const part = getElementByShadowIds(document, ["c-e-outer", "c-e-inner", "part6"]);
+        assert_equals(window.getComputedStyle(part).color, colorGreen);
+        assert_equals(window.getComputedStyle(part, "::before").color, colorGreen);
+        assert_equals(window.getComputedStyle(part, "::after").color, colorGreen);
+      }, "Multiple exports for a single part");
+    </script>
+  </body>
+</html>
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to