tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_condition_text.html (1868B)


      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 src="/tests/SimpleTest/SimpleTest.js"></script>
      9  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
     10  <style id="style">
     11    @media all {}
     12    @media only color {}
     13    @media (color ) {}
     14    @media color \0061ND ( monochrome ) {}
     15    @media (max-width: 200px), (color) {}
     16 
     17    @supports(color: green){}
     18    @supports (color: green) {}
     19    @supports ((color: green)) {}
     20    @supports (color: green) and (color: blue) {}
     21    @supports ( Font:  20px serif ! Important)  {}
     22  </style>
     23 </head>
     24 <body>
     25 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=814907">Mozilla Bug 814907</a>
     26 <p id="display"></p>
     27 <div id="content" style="display: none">
     28 
     29 </div>
     30 <pre id="test">
     31 <script type="application/javascript">
     32 
     33 /** Test for Bug 814907 */
     34 
     35 function runTest()
     36 {
     37  // re-parse the style sheet with the pref turned on
     38  var style = document.getElementById("style");
     39  style.textContent += " ";
     40 
     41  var sheet = style.sheet;
     42 
     43  var conditions = [
     44    "all",
     45    "only color",
     46    "(color)",
     47    "color and (monochrome)",
     48    "(max-width: 200px), (color)",
     49    "(color: green)",
     50    "(color: green)",
     51    "((color: green))",
     52    "(color: green) and (color: blue)",
     53    "( Font:  20px serif ! Important)"
     54  ];
     55 
     56  is(sheet.cssRules.length, conditions.length);
     57 
     58  for (var i = 0; i < sheet.cssRules.length; i++) {
     59    var rule = sheet.cssRules[i];
     60    is(rule.conditionText, conditions[i], "rule " + i + " has expected conditionText");
     61    if (rule.type == CSSRule.MEDIA_RULE) {
     62      is(rule.conditionText, rule.media.mediaText, "rule " + i + " conditionText matches media.mediaText");
     63    }
     64  }
     65 
     66  SimpleTest.finish();
     67 }
     68 
     69 SimpleTest.waitForExplicitFinish();
     70 runTest();
     71 </script>
     72 </pre>
     73 </body>
     74 </html>