Wed, 31 Dec 2014 13:27:57 +0100
Ignore runtime configuration files generated during quality assurance.
michael@0 | 1 | <!DOCTYPE HTML> |
michael@0 | 2 | <html> |
michael@0 | 3 | <!-- |
michael@0 | 4 | https://bugzilla.mozilla.org/show_bug.cgi?id=779917 |
michael@0 | 5 | --> |
michael@0 | 6 | <head> |
michael@0 | 7 | <title>Test for Bug 779917</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=779917">Mozilla Bug 779917</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 779917 **/ |
michael@0 | 21 | |
michael@0 | 22 | function runTest() |
michael@0 | 23 | { |
michael@0 | 24 | var passingConditions = [ |
michael@0 | 25 | "(color: green)", |
michael@0 | 26 | "((color: green))", |
michael@0 | 27 | "(color: green !important)", |
michael@0 | 28 | "(color: rainbow) or (color: green)", |
michael@0 | 29 | "(color: green) or (color: rainbow)", |
michael@0 | 30 | "(color: green) and (color: blue)", |
michael@0 | 31 | "(color: rainbow) or (color: iridescent) or (color: green)", |
michael@0 | 32 | "(color: red) and (color: green) and (color: blue)", |
michael@0 | 33 | "(color:green)", |
michael@0 | 34 | "not (color: rainbow)", |
michael@0 | 35 | "not (not (color: green))", |
michael@0 | 36 | "(unknown:) or (color: green)", |
michael@0 | 37 | "(unknown) or (color: green)", |
michael@0 | 38 | "(font: 16px serif)", |
michael@0 | 39 | "(color:) or (color: green)", |
michael@0 | 40 | "not (@page)", |
michael@0 | 41 | "not ({ something @with [ balanced ] brackets })", |
michael@0 | 42 | "an-extension(of some kind) or (color: green)", |
michael@0 | 43 | "not ()", |
michael@0 | 44 | "( Font: 20px serif ! Important) ", |
michael@0 | 45 | "(color: /* comment */ green)", |
michael@0 | 46 | "(/* comment */ color: green)", |
michael@0 | 47 | "(color: green /* comment */)", |
michael@0 | 48 | "(color: green) /* comment */", |
michael@0 | 49 | "/* comment */ (color: green)", |
michael@0 | 50 | "(color /* comment */: green)", |
michael@0 | 51 | "(color: green) /* unclosed comment", |
michael@0 | 52 | "(color: green", |
michael@0 | 53 | "(((((((color: green", |
michael@0 | 54 | "(font-family: 'Helvetica" |
michael@0 | 55 | ]; |
michael@0 | 56 | |
michael@0 | 57 | var failingConditions = [ |
michael@0 | 58 | "(color: rainbow)", |
michael@0 | 59 | "(color: rainbow) and (color: green)", |
michael@0 | 60 | "(color: blue) and (color: rainbow)", |
michael@0 | 61 | "(color: green) and (color: green) or (color: green)", |
michael@0 | 62 | "(color: green) or (color: green) and (color: green)", |
michael@0 | 63 | "not not (color: green)", |
michael@0 | 64 | "not (color: rainbow) and not (color: iridescent)", |
michael@0 | 65 | "not (color: rainbow) or (color: green)", |
michael@0 | 66 | "(not (color: rainbow) or (color: green))", |
michael@0 | 67 | "(unknown: green)", |
michael@0 | 68 | "not ({ something @with (unbalanced brackets })", |
michael@0 | 69 | "(color: green) or an-extension(that is [unbalanced)", |
michael@0 | 70 | "not(unknown: unknown)", |
michael@0 | 71 | "(color: green) or(color: blue)", |
michael@0 | 72 | "color: green", |
michael@0 | 73 | "(color: green;)", |
michael@0 | 74 | "(font-family: 'Helvetica\n", |
michael@0 | 75 | "(font-family: 'Helvetica\n')", |
michael@0 | 76 | "()", |
michael@0 | 77 | "" |
michael@0 | 78 | ]; |
michael@0 | 79 | |
michael@0 | 80 | var passingDeclarations = [ |
michael@0 | 81 | ["color", "green"], |
michael@0 | 82 | ["color", " green "], |
michael@0 | 83 | ["Color", "Green"], |
michael@0 | 84 | ["color", "green /* comment */"], |
michael@0 | 85 | ["color", "/* comment */ green"], |
michael@0 | 86 | ["color", "green /* unclosed comment"], |
michael@0 | 87 | ["font", "16px serif"], |
michael@0 | 88 | ["font", "16px /* comment */ serif"], |
michael@0 | 89 | ["font", "16px\nserif"], |
michael@0 | 90 | ["color", "\\0067reen"] |
michael@0 | 91 | ]; |
michael@0 | 92 | |
michael@0 | 93 | var failingDeclarations = [ |
michael@0 | 94 | ["color ", "green"], |
michael@0 | 95 | ["color", "rainbow"], |
michael@0 | 96 | ["color", "green green"], |
michael@0 | 97 | ["color", "green !important"], |
michael@0 | 98 | ["\\0063olor", "green"], |
michael@0 | 99 | ["/* comment */color", "green"], |
michael@0 | 100 | ["color/* comment */", "green"], |
michael@0 | 101 | ["font-family", "'Helvetica\n"], |
michael@0 | 102 | ["font-family", "'Helvetica\n'"], |
michael@0 | 103 | ["color", "green;"], |
michael@0 | 104 | ["color", ""], |
michael@0 | 105 | ["unknown", "unknown"], |
michael@0 | 106 | ["", "green"], |
michael@0 | 107 | ["", ""] |
michael@0 | 108 | ]; |
michael@0 | 109 | |
michael@0 | 110 | passingConditions.forEach(function(aCondition) { |
michael@0 | 111 | is(CSS.supports(aCondition), true, "CSS.supports returns true for passing condition \"" + aCondition + "\""); |
michael@0 | 112 | }); |
michael@0 | 113 | |
michael@0 | 114 | failingConditions.forEach(function(aCondition) { |
michael@0 | 115 | is(CSS.supports(aCondition), false, "CSS.supports returns false for failing condition \"" + aCondition + "\""); |
michael@0 | 116 | }); |
michael@0 | 117 | |
michael@0 | 118 | passingDeclarations.forEach(function(aDeclaration) { |
michael@0 | 119 | is(CSS.supports(aDeclaration[0], aDeclaration[1]), true, "CSS.supports returns true for supported declaration \"" + aDeclaration.join(":") + "\""); |
michael@0 | 120 | }); |
michael@0 | 121 | |
michael@0 | 122 | failingDeclarations.forEach(function(aDeclaration) { |
michael@0 | 123 | is(CSS.supports(aDeclaration[0], aDeclaration[1]), false, "CSS.supports returns false for unsupported declaration \"" + aDeclaration.join(":") + "\""); |
michael@0 | 124 | }); |
michael@0 | 125 | |
michael@0 | 126 | SimpleTest.finish(); |
michael@0 | 127 | } |
michael@0 | 128 | |
michael@0 | 129 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 130 | SpecialPowers.pushPrefEnv({ "set": [["layout.css.supports-rule.enabled", true]] }, runTest); |
michael@0 | 131 | </script> |
michael@0 | 132 | </pre> |
michael@0 | 133 | </body> |
michael@0 | 134 | </html> |