layout/style/test/test_condition_text.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=814907
michael@0 5 -->
michael@0 6 <head>
michael@0 7 <title>Test for Bug 814907</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 <style id="style">
michael@0 11 @-moz-document url(http://www.example.com/) {}
michael@0 12 @-moz-document url('http://www.example.com/') {}
michael@0 13 @-moz-document url("http://www.example.com/") {}
michael@0 14 @-moz-document url-prefix('http://www.example.com/') {}
michael@0 15 @-moz-document url-prefix("http://www.example.com/") {}
michael@0 16 @-moz-document domain('example.com') {}
michael@0 17 @-moz-document domain("example.com") {}
michael@0 18 @-moz-document regexp('http://www.w3.org/TR/\\d{4}/[^/]*-CSS2-\\d{8}/') {}
michael@0 19 @-moz-document regexp("http://www.w3.org/TR/\\d{4}/[^/]*-CSS2-\\d{8}/") {}
michael@0 20
michael@0 21 @media all {}
michael@0 22 @media only color {}
michael@0 23 @media (color ) {}
michael@0 24 @media color \0061ND ( monochrome ) {}
michael@0 25 @media (max-width: 200px), (color) {}
michael@0 26
michael@0 27 @supports(color: green){}
michael@0 28 @supports (color: green) {}
michael@0 29 @supports ((color: green)) {}
michael@0 30 @supports (color: green) and (color: blue) {}
michael@0 31 @supports ( Font: 20px serif ! Important) {}
michael@0 32 </style>
michael@0 33 </head>
michael@0 34 <body>
michael@0 35 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=814907">Mozilla Bug 814907</a>
michael@0 36 <p id="display"></p>
michael@0 37 <div id="content" style="display: none">
michael@0 38
michael@0 39 </div>
michael@0 40 <pre id="test">
michael@0 41 <script type="application/javascript">
michael@0 42
michael@0 43 /** Test for Bug 814907 **/
michael@0 44
michael@0 45 function runTest()
michael@0 46 {
michael@0 47 // re-parse the style sheet with the pref turned on
michael@0 48 var style = document.getElementById("style");
michael@0 49 style.textContent += " ";
michael@0 50
michael@0 51 var sheet = style.sheet;
michael@0 52
michael@0 53 var conditions = [
michael@0 54 "url(\"http://www.example.com/\")",
michael@0 55 "url(\"http://www.example.com/\")",
michael@0 56 "url(\"http://www.example.com/\")",
michael@0 57 "url-prefix(\"http://www.example.com/\")",
michael@0 58 "url-prefix(\"http://www.example.com/\")",
michael@0 59 "domain(\"example.com\")",
michael@0 60 "domain(\"example.com\")",
michael@0 61 "regexp(\"http://www.w3.org/TR/\\\\d{4}/[^/]*-CSS2-\\\\d{8}/\")",
michael@0 62 "regexp(\"http://www.w3.org/TR/\\\\d{4}/[^/]*-CSS2-\\\\d{8}/\")",
michael@0 63 "all",
michael@0 64 "only color",
michael@0 65 "(color)",
michael@0 66 "color and (monochrome)",
michael@0 67 "(max-width: 200px), (color)",
michael@0 68 "(color: green)",
michael@0 69 "(color: green)",
michael@0 70 "((color: green))",
michael@0 71 "(color: green) and (color: blue)",
michael@0 72 "( Font: 20px serif ! Important)"
michael@0 73 ];
michael@0 74
michael@0 75 is(sheet.cssRules.length, conditions.length);
michael@0 76
michael@0 77 for (var i = 0; i < sheet.cssRules.length; i++) {
michael@0 78 var rule = sheet.cssRules[i];
michael@0 79 is(rule.conditionText, conditions[i], "rule " + i + " has expected conditionText");
michael@0 80 if (rule.type == CSSRule.MEDIA_RULE) {
michael@0 81 is(rule.conditionText, rule.media.mediaText, "rule " + i + " conditionText matches media.mediaText");
michael@0 82 }
michael@0 83 }
michael@0 84
michael@0 85 SimpleTest.finish();
michael@0 86 }
michael@0 87
michael@0 88 SimpleTest.waitForExplicitFinish();
michael@0 89 SpecialPowers.pushPrefEnv({ "set": [["layout.css.supports-rule.enabled", true]] }, runTest);
michael@0 90 </script>
michael@0 91 </pre>
michael@0 92 </body>
michael@0 93 </html>

mercurial