layout/style/test/test_css_supports_variables.html

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

michael@0 1 <!DOCTYPE HTML>
michael@0 2 <html>
michael@0 3 <!--
michael@0 4 https://bugzilla.mozilla.org/show_bug.cgi?id=773296
michael@0 5 -->
michael@0 6 <head>
michael@0 7 <title>Test for Bug 773296</title>
michael@0 8 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
michael@0 9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
michael@0 10 </head>
michael@0 11 <body>
michael@0 12 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=773296">Mozilla Bug 773296</a>
michael@0 13 <p id="display"></p>
michael@0 14 <div id="content" style="display: none">
michael@0 15
michael@0 16 </div>
michael@0 17 <pre id="test">
michael@0 18 <script type="application/javascript">
michael@0 19
michael@0 20 /** Test for Bug 773296 **/
michael@0 21
michael@0 22 function runTest()
michael@0 23 {
michael@0 24 var passingConditions = [
michael@0 25 "(color:var(--a))",
michael@0 26 "(color: var(--a))",
michael@0 27 "(color: var(--a) )",
michael@0 28 "(color: var( --a ) )",
michael@0 29 "(color: var(--a, ))",
michael@0 30 "(color: var(--))",
michael@0 31 "(color: var(--a,/**/a))",
michael@0 32 "(color: 1px var(--a))",
michael@0 33 "(color: var(--a) 1px)",
michael@0 34 "(color: something 3px url(whereever) calc(var(--a) + 1px))",
michael@0 35 "(color: var(--a) !important)",
michael@0 36 "(color: var(--a)var(--b))",
michael@0 37 "(color: var(--a, var(--b, var(--c, black))))",
michael@0 38 "(color: var(--a) <!--)",
michael@0 39 "(color: --> var(--a))",
michael@0 40 "(color: { [ var(--a) ] })",
michael@0 41 "(color: [;] var(--a))",
michael@0 42 "(color: var(--a,(;)))",
michael@0 43 "(color: VAR(--a))",
michael@0 44 "(color: var(--0))",
michael@0 45 "(color: var(--\\30))",
michael@0 46 "(color: var(--\\d800))",
michael@0 47 "(color: var(--\\ffffff))",
michael@0 48 "(color: var(--",
michael@0 49 "(color: var(--a",
michael@0 50 "(color: var(--a , ",
michael@0 51 "(color: var(--a, ",
michael@0 52 "(color: var(--a, var(--b",
michael@0 53 "(color: var(--a /* unclosed comment",
michael@0 54 "(color: var(--a, '",
michael@0 55 "(color: var(--a, '\\",
michael@0 56 "(color: var(--a, \\",
michael@0 57
michael@0 58 "(--a:var(--b))",
michael@0 59 "(--a: var(--b))",
michael@0 60 "(--a: var(--b) )",
michael@0 61 "(--a: var( --b ) )",
michael@0 62 "(--a: var(--b, ))",
michael@0 63 "(--a: var(--b,/**/a))",
michael@0 64 "(--a: 1px var(--b))",
michael@0 65 "(--a: var(--b) 1px)",
michael@0 66 "(--a: something 3px url(whereever) calc(var(--b) + 1px))",
michael@0 67 "(--a: var(--b) !important)",
michael@0 68 "(--a: var(--b)var(--b))",
michael@0 69 "(--a: var(--b, var(--c, var(--d, black))))",
michael@0 70 "(--a: var(--b) <!--)",
michael@0 71 "(--a: --> var(--b))",
michael@0 72 "(--a: { [ var(--b) ] })",
michael@0 73 "(--a: [;] var(--b))",
michael@0 74 "(--a: )",
michael@0 75 "(--a:var(--a))",
michael@0 76 "(--0: a)",
michael@0 77 "(--\\30: a)",
michael@0 78 "(--\\61: a)",
michael@0 79 "(--\\d800: a)",
michael@0 80 "(--\\ffffff: a)",
michael@0 81 "(--\0: 1)",
michael@0 82 "(--a: ",
michael@0 83 "(--a: /* unclosed comment",
michael@0 84 "(--a: var(--b",
michael@0 85 "(--a: var(--b, ",
michael@0 86 "(--a: var(--b, var(--c",
michael@0 87 "(--a: [{(((",
michael@0 88 "(--a: '",
michael@0 89 "(--a: '\\",
michael@0 90 "(--a: \\",
michael@0 91 "(--: a)",
michael@0 92 ];
michael@0 93
michael@0 94 var failingConditions = [
michael@0 95 "(color: var(--a,))",
michael@0 96 "(color: var(--a,/**/))",
michael@0 97 "(color: var(--a,!))",
michael@0 98 "(color: var(--a,!important))",
michael@0 99 "(color: var(--a) !important !important)",
michael@0 100 "(color: var(--a,;))",
michael@0 101 "(color: var(--a);)",
michael@0 102 "(color: var(1px))",
michael@0 103 "(color: var(--a)))",
michael@0 104 "(color: var(--a) \"\n",
michael@0 105 "(color: var(--a) url(\"\n",
michael@0 106 "(color: var(a))",
michael@0 107
michael@0 108 "(--a: var(--b,))",
michael@0 109 "(--a: var(--b,/**/))",
michael@0 110 "(--a: var(--b,!))",
michael@0 111 "(--a: var(--b,!important))",
michael@0 112 "((--a: var(--b) !important !important))",
michael@0 113 "(--a: var(--b,;))",
michael@0 114 "(--a: var(--b);)",
michael@0 115 "(--a:)",
michael@0 116 "(--a: var(1px))",
michael@0 117 "(--a: a))",
michael@0 118 "(--a: \"\n",
michael@0 119 "(--a: url(\"\n",
michael@0 120 "(--a: var(a))",
michael@0 121 ];
michael@0 122
michael@0 123 var passingDeclarations = [
michael@0 124 ["color", "var(--a)"],
michael@0 125 ["color", " var(--a)"],
michael@0 126 ["color", "var(--a) "],
michael@0 127 ["color", "var( --a ) "],
michael@0 128 ["color", "var(--a, )"],
michael@0 129 ["color", "var(--a,/**/a)"],
michael@0 130 ["color", "1px var(--a)"],
michael@0 131 ["color", "var(--a) 1px"],
michael@0 132 ["color", "something 3px url(whereever) calc(var(--a) + 1px)"],
michael@0 133 ["color", "var(--a)var(--b)"],
michael@0 134 ["color", "var(--a, var(--b, var(--c, black)))"],
michael@0 135 ["color", "var(--a) <!--"],
michael@0 136 ["color", "--> var(--a)"],
michael@0 137 ["color", "{ [ var(--a) ] }"],
michael@0 138 ["color", "[;] var(--a)"],
michael@0 139 ["color", "var(--a,(;))"],
michael@0 140 ["color", "VAR(--a)"],
michael@0 141 ["color", "var(--0)"],
michael@0 142 ["color", "var(--\\30)"],
michael@0 143 ["color", "var(--\\d800)"],
michael@0 144 ["color", "var(--\\ffffff)"],
michael@0 145 ["color", "var(--a"],
michael@0 146 ["color", "var(--a , "],
michael@0 147 ["color", "var(--a, "],
michael@0 148 ["color", "var(--a, var(--b"],
michael@0 149 ["color", "var(--a /* unclosed comment"],
michael@0 150 ["color", "var(--a, '"],
michael@0 151 ["color", "var(--a, '\\"],
michael@0 152 ["color", "var(--a, \\"],
michael@0 153 ["color", "var(--"],
michael@0 154
michael@0 155 ["--a", " var(--b)"],
michael@0 156 ["--a", "var(--b)"],
michael@0 157 ["--a", "var(--b) "],
michael@0 158 ["--a", "var( --b ) "],
michael@0 159 ["--a", "var(--b, )"],
michael@0 160 ["--a", "var(--b,/**/a)"],
michael@0 161 ["--a", "1px var(--b)"],
michael@0 162 ["--a", "var(--b) 1px"],
michael@0 163 ["--a", "something 3px url(whereever) calc(var(--b) + 1px)"],
michael@0 164 ["--a", "var(--b)var(--b)"],
michael@0 165 ["--a", "var(--b, var(--c, var(--d, black)))"],
michael@0 166 ["--a", "var(--b) <!--"],
michael@0 167 ["--a", "--> var(--b)"],
michael@0 168 ["--a", "{ [ var(--b) ] }"],
michael@0 169 ["--a", "[;] var(--b)"],
michael@0 170 ["--a", " "],
michael@0 171 ["--a", "var(--a)"],
michael@0 172 ["--0", "a"],
michael@0 173 ["--\\30", "a"],
michael@0 174 ["--\\61", "a"],
michael@0 175 ["--\\d800", "a"],
michael@0 176 ["--\\ffffff", "a"],
michael@0 177 ["--\0", "a"],
michael@0 178 ["--\ud800", "a"],
michael@0 179 ["--a", "a /* unclosed comment"],
michael@0 180 ["--a", "var(--b"],
michael@0 181 ["--a", "var(--b, "],
michael@0 182 ["--a", "var(--b, var(--c"],
michael@0 183 ["--a", "[{((("],
michael@0 184 ["--a ", "a"],
michael@0 185 ["--a ", "'"],
michael@0 186 ["--a ", "'\\"],
michael@0 187 ["--a ", "\\"],
michael@0 188 ["--", "a"],
michael@0 189 ];
michael@0 190
michael@0 191 var failingDeclarations = [
michael@0 192 ["color", "var(--a,)"],
michael@0 193 ["color", "var(--a,/**/)"],
michael@0 194 ["color", "var(--a,!)"],
michael@0 195 ["color", "var(--a,!important)"],
michael@0 196 ["color", "var(--a,;)"],
michael@0 197 ["color", "var(--a);"],
michael@0 198 ["color", "var(1px)"],
michael@0 199 ["color", "var(--a))"],
michael@0 200 ["color", "var(--a) \"\n"],
michael@0 201 ["color", "var(--a) url(\"\n"],
michael@0 202 ["color", "var(--a) !important"],
michael@0 203 ["color", "var(--a) !important !important"],
michael@0 204 ["color", "var(a)"],
michael@0 205
michael@0 206 ["--a", "var(--b,)"],
michael@0 207 ["--a", "var(--b,/**/)"],
michael@0 208 ["--a", "var(--b,!)"],
michael@0 209 ["--a", "var(--b,!important)"],
michael@0 210 ["--a", "var(--b) !important !important"],
michael@0 211 ["--a", "var(--b,;)"],
michael@0 212 ["--a", "var(--b);"],
michael@0 213 ["--a", ""],
michael@0 214 ["--a", "var(1px)"],
michael@0 215 ["(VAR-a", "a"],
michael@0 216 ["--a", "a)"],
michael@0 217 ["--a", "\"\n"],
michael@0 218 ["--a", "url(\"\n"],
michael@0 219 ["--a", "var(--b))"],
michael@0 220 ["--a", "var(b)"],
michael@0 221 ];
michael@0 222
michael@0 223 passingConditions.forEach(function(aCondition) {
michael@0 224 is(CSS.supports(aCondition), true, "CSS.supports returns true for passing condition \"" + aCondition + "\"");
michael@0 225 });
michael@0 226
michael@0 227 failingConditions.forEach(function(aCondition) {
michael@0 228 is(CSS.supports(aCondition), false, "CSS.supports returns false for failing condition \"" + aCondition + "\"");
michael@0 229 });
michael@0 230
michael@0 231 passingDeclarations.forEach(function(aDeclaration) {
michael@0 232 is(CSS.supports(aDeclaration[0], aDeclaration[1]), true, "CSS.supports returns true for supported declaration \"" + aDeclaration.join(":") + "\"");
michael@0 233 });
michael@0 234
michael@0 235 failingDeclarations.forEach(function(aDeclaration) {
michael@0 236 is(CSS.supports(aDeclaration[0], aDeclaration[1]), false, "CSS.supports returns false for unsupported declaration \"" + aDeclaration.join(":") + "\"");
michael@0 237 });
michael@0 238
michael@0 239 SimpleTest.finish();
michael@0 240 }
michael@0 241
michael@0 242 SimpleTest.waitForExplicitFinish();
michael@0 243 SpecialPowers.pushPrefEnv({ "set": [["layout.css.supports-rule.enabled", true],
michael@0 244 ["layout.css.variables.enabled", true]] }, runTest);
michael@0 245 </script>
michael@0 246 </pre>
michael@0 247 </body>
michael@0 248 </html>

mercurial