Bug 1378368 - part3: add tests. draft
authorJeremy Chen <jeremychen@mozilla.com>
Mon, 16 Oct 2017 14:41:51 +0800
changeset 680749 34447a93c984495f92d9458369e85a7e36066f44
parent 680721 b1135eece4e243c6e81efcb7f4d78e0069758186
child 680757 5948d65df4f73d5f470fe1038ac9e71ad1821513
push id84613
push userbmo:jeremychen@mozilla.com
push dateMon, 16 Oct 2017 08:44:23 +0000
bugs1378368
milestone58.0a1
Bug 1378368 - part3: add tests. MozReview-Commit-ID: Amy7Dcyz8cq
layout/style/test/test_computed_style.html
--- a/layout/style/test/test_computed_style.html
+++ b/layout/style/test/test_computed_style.html
@@ -697,12 +697,38 @@ var noframe_container = document.getElem
         p.style.removeProperty(prop);
       }
     }
   }
 
   p.remove();
 })();
 
+(function test_bug_1378368() {
+  // Test that negative results of calc()s in basic-shapes (e.g. polygon()) should
+  // not be clamped to 0px.
+  var clipPaths = [
+    // [ specified style,
+    //   expected computed style,
+    //   descriptionOfTestcase ],
+    // polygon:
+    [ "polygon(calc(10px - 20px) 0px, 100px 100px, 0px 100px)",
+      "polygon(-10px 0px, 100px 100px, 0px 100px)",
+      "polygon with negative calc() coordinates" ],
+  ];
+
+  var p = document.createElement("p");
+  var cs = getComputedStyle(p, "");
+  frame_container.appendChild(p);
+
+  for (let test of clipPaths) {
+    p.style.clipPath = test[0];
+    is(cs.clipPath, test[1],
+       "computed value of clip-path for basic-shapes (" + test[2] + ")");
+  }
+
+  p.remove();
+})();
+
 </script>
 </pre>
 </body>
 </html>