tor-browser

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

test_units_time.html (1302B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <head>
      4  <title>Test for serialization and equivalence of time units</title>
      5  <script src="/tests/SimpleTest/SimpleTest.js"></script>
      6  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
      7 </head>
      8 <body>
      9 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=">Mozilla Bug </a>
     10 <p id="display"></p>
     11 <div id="content" style="display: none">
     12  
     13 </div>
     14 <pre id="test">
     15 <script type="application/javascript">
     16 
     17 /** Test for serialization and equivalence of time units */
     18 
     19 /**
     20 * We test that for each of the following:
     21 *  + they reserialize to exactly what is given
     22 *  + if a mapping is provided, they compute to the same result as the mapping
     23 */
     24 var tests = {
     25  "3s": "3000ms",
     26  "500ms": "0.5s"
     27 };
     28 
     29 var p = document.getElementById("display");
     30 
     31 for (var test in tests) {
     32  p.setAttribute("style", "transition-duration: " + test);
     33  is(p.style.getPropertyValue("transition-duration"), test,
     34     test + " serializes to exactly itself");
     35  var equiv = tests[test];
     36  if (equiv) {
     37    var cm1 = getComputedStyle(p, "").transitionDuration;
     38    p.style.transitionDuration = equiv;
     39    var cm2 = getComputedStyle(p, "").transitionDuration;
     40    is(cm1, cm2, test + " should compute to the same as " + equiv);
     41  }
     42 }
     43 
     44 </script>
     45 </pre>
     46 </body>
     47 </html>