tor-browser

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

test_bug319381.html (2090B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <!--
      4 https://bugzilla.mozilla.org/show_bug.cgi?id=319381
      5 -->
      6 <head>
      7  <title>Test for Bug 319381</title>
      8  <script src="/tests/SimpleTest/SimpleTest.js"></script>        
      9  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
     10 </head>
     11 <body>
     12 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=319381">Mozilla Bug 319381</a>
     13 <p id="display"></p>
     14 <div id="content" style="display: none">
     15  <div id="t"></div>  
     16 </div>
     17 <pre id="test">
     18 <script class="testbody" type="text/javascript">
     19 
     20 /** Test for Bug 319381 */
     21 
     22 function c() {
     23  return document.defaultView.getComputedStyle($('t')).
     24    getPropertyValue("overflow");
     25 }
     26 
     27 var vals = ["visible", "hidden", "auto", "scroll"];
     28 var mozVals = ["-moz-scrollbars-vertical", "-moz-scrollbars-horizontal"];
     29 var i, j;
     30 
     31 for (i = 0; i < vals.length; ++i) {
     32  $('t').style.overflow = vals[i];
     33  is($('t').style.overflow, vals[i], "Roundtrip");
     34  is(c(), vals[i], "Simple property set");
     35 }
     36 
     37 for (i = 0; i < vals.length; ++i) {
     38  for (j = 0; j < vals.length; ++j) {
     39    $('t').setAttribute("style",
     40                        "overflow-x: " + vals[i] + "; overflow-y: " + vals[j]);
     41    is($('t').style.getPropertyValue("overflow-x"), vals[i], "Roundtrip");
     42    is($('t').style.getPropertyValue("overflow-y"), vals[j], "Roundtrip");
     43 
     44    if (i == j) {
     45      is($('t').style.overflow, vals[i], "Shorthand serialization");
     46    } else {
     47      is($('t').style.overflow, vals[i] + " " + vals[j], "Shorthand serialization");
     48    }
     49 
     50    // "visible" overflow-x and overflow-y become "auto" in computed style if
     51    // the other direction is not also "visible".
     52    if (i == j || (vals[i] == "visible" && vals[j] == "auto")) {
     53      is(c(), vals[j], "Shorthand computation");
     54    } else if (vals[j] == "visible" && vals[i] == "auto") {
     55      is(c(), vals[i], "Shorthand computation");
     56    } else {
     57      let x = vals[i] == "visible" ? "auto" : vals[i];
     58      let y = vals[j] == "visible" ? "auto" : vals[j];
     59      is(c(), x + " " + y, "Shorthand computation");
     60    }
     61  }
     62 }
     63 </script>
     64 </pre>
     65 </body>
     66 </html>