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.)

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

mercurial