summaryrefslogtreecommitdiffstats
path: root/layout/inspector/tests/test_css_property_is_valid.html
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /layout/inspector/tests/test_css_property_is_valid.html
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'layout/inspector/tests/test_css_property_is_valid.html')
-rw-r--r--layout/inspector/tests/test_css_property_is_valid.html105
1 files changed, 105 insertions, 0 deletions
diff --git a/layout/inspector/tests/test_css_property_is_valid.html b/layout/inspector/tests/test_css_property_is_valid.html
new file mode 100644
index 000000000..21f00bf18
--- /dev/null
+++ b/layout/inspector/tests/test_css_property_is_valid.html
@@ -0,0 +1,105 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <meta charset="utf-8">
+ <title>Test inDOMUtils::CssPropertyIsValid</title>
+ <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+ <script type="application/javascript;version=1.8">
+ let utils = SpecialPowers.Cc["@mozilla.org/inspector/dom-utils;1"]
+ .getService(SpecialPowers.Ci.inIDOMUtils);
+
+ let tests = [
+ {
+ property: "color",
+ value: "red",
+ expected: true
+ },
+ {
+ property: "display",
+ value: "none",
+ expected: true
+ },
+ {
+ property: "display",
+ value: "red",
+ expected: false
+ },
+ {
+ property: "displayx",
+ value: "none",
+ expected: false
+ },
+ {
+ property: "border",
+ value: "1px solid blue",
+ expected: true
+ },
+ {
+ property: "border",
+ value: "1 solid blue",
+ expected: false
+ },
+ {
+ property: "border",
+ value: "1px underline blue",
+ expected: false
+ },
+ {
+ property: "border",
+ value: "1px solid",
+ expected: true
+ },
+ {
+ property: "color",
+ value: "blue !important",
+ expected: true
+ },
+ {
+ property: "color",
+ value: "blue ! important",
+ expected: true
+ },
+ {
+ property: "color",
+ value: "blue !impoxxxrtant",
+ expected: false
+ },
+ {
+ property: "color",
+ value: "red; background:green;",
+ expected: false
+ },
+ {
+ property: "content",
+ value: "\"hello\"",
+ expected: true
+ },
+ {
+ property: "color",
+ value: "var(--some-kind-of-green)",
+ expected: true
+ }
+ ];
+
+ for (let {property, value, expected} of tests) {
+ let valid = utils.cssPropertyIsValid(property, value);
+
+ if (expected) {
+ ok(valid, property + ":" + value + " is valid");
+ } else {
+ ok(!valid, property + ":" + value + " is not valid");
+ }
+ }
+ </script>
+</head>
+<body>
+<h1>Test inDOMUtils::CssPropertyIsValid</h1>
+<p id="display"></p>
+<div id="content" style="display: none">
+
+</div>
+<pre id="test">
+</pre>
+</body>
+</html>