Wed, 31 Dec 2014 07:16:47 +0100
Revert simplistic fix pending revisit of Mozilla integration attempt.
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=779917
5 -->
6 <head>
7 <title>Test for Bug 779917</title>
8 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
10 </head>
11 <body>
12 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=779917">Mozilla Bug 779917</a>
13 <p id="display"></p>
14 <div id="content" style="display: none">
16 </div>
17 <pre id="test">
18 <script type="application/javascript">
20 /** Test for Bug 779917 **/
22 function runTest()
23 {
24 var passingConditions = [
25 "(color: green)",
26 "((color: green))",
27 "(color: green !important)",
28 "(color: rainbow) or (color: green)",
29 "(color: green) or (color: rainbow)",
30 "(color: green) and (color: blue)",
31 "(color: rainbow) or (color: iridescent) or (color: green)",
32 "(color: red) and (color: green) and (color: blue)",
33 "(color:green)",
34 "not (color: rainbow)",
35 "not (not (color: green))",
36 "(unknown:) or (color: green)",
37 "(unknown) or (color: green)",
38 "(font: 16px serif)",
39 "(color:) or (color: green)",
40 "not (@page)",
41 "not ({ something @with [ balanced ] brackets })",
42 "an-extension(of some kind) or (color: green)",
43 "not ()",
44 "( Font: 20px serif ! Important) ",
45 "(color: /* comment */ green)",
46 "(/* comment */ color: green)",
47 "(color: green /* comment */)",
48 "(color: green) /* comment */",
49 "/* comment */ (color: green)",
50 "(color /* comment */: green)",
51 "(color: green) /* unclosed comment",
52 "(color: green",
53 "(((((((color: green",
54 "(font-family: 'Helvetica"
55 ];
57 var failingConditions = [
58 "(color: rainbow)",
59 "(color: rainbow) and (color: green)",
60 "(color: blue) and (color: rainbow)",
61 "(color: green) and (color: green) or (color: green)",
62 "(color: green) or (color: green) and (color: green)",
63 "not not (color: green)",
64 "not (color: rainbow) and not (color: iridescent)",
65 "not (color: rainbow) or (color: green)",
66 "(not (color: rainbow) or (color: green))",
67 "(unknown: green)",
68 "not ({ something @with (unbalanced brackets })",
69 "(color: green) or an-extension(that is [unbalanced)",
70 "not(unknown: unknown)",
71 "(color: green) or(color: blue)",
72 "color: green",
73 "(color: green;)",
74 "(font-family: 'Helvetica\n",
75 "(font-family: 'Helvetica\n')",
76 "()",
77 ""
78 ];
80 var passingDeclarations = [
81 ["color", "green"],
82 ["color", " green "],
83 ["Color", "Green"],
84 ["color", "green /* comment */"],
85 ["color", "/* comment */ green"],
86 ["color", "green /* unclosed comment"],
87 ["font", "16px serif"],
88 ["font", "16px /* comment */ serif"],
89 ["font", "16px\nserif"],
90 ["color", "\\0067reen"]
91 ];
93 var failingDeclarations = [
94 ["color ", "green"],
95 ["color", "rainbow"],
96 ["color", "green green"],
97 ["color", "green !important"],
98 ["\\0063olor", "green"],
99 ["/* comment */color", "green"],
100 ["color/* comment */", "green"],
101 ["font-family", "'Helvetica\n"],
102 ["font-family", "'Helvetica\n'"],
103 ["color", "green;"],
104 ["color", ""],
105 ["unknown", "unknown"],
106 ["", "green"],
107 ["", ""]
108 ];
110 passingConditions.forEach(function(aCondition) {
111 is(CSS.supports(aCondition), true, "CSS.supports returns true for passing condition \"" + aCondition + "\"");
112 });
114 failingConditions.forEach(function(aCondition) {
115 is(CSS.supports(aCondition), false, "CSS.supports returns false for failing condition \"" + aCondition + "\"");
116 });
118 passingDeclarations.forEach(function(aDeclaration) {
119 is(CSS.supports(aDeclaration[0], aDeclaration[1]), true, "CSS.supports returns true for supported declaration \"" + aDeclaration.join(":") + "\"");
120 });
122 failingDeclarations.forEach(function(aDeclaration) {
123 is(CSS.supports(aDeclaration[0], aDeclaration[1]), false, "CSS.supports returns false for unsupported declaration \"" + aDeclaration.join(":") + "\"");
124 });
126 SimpleTest.finish();
127 }
129 SimpleTest.waitForExplicitFinish();
130 SpecialPowers.pushPrefEnv({ "set": [["layout.css.supports-rule.enabled", true]] }, runTest);
131 </script>
132 </pre>
133 </body>
134 </html>