layout/style/test/test_units_time.html

Wed, 31 Dec 2014 07:16:47 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 07:16:47 +0100
branch
TOR_BUG_9701
changeset 3
141e0f1194b1
permissions
-rw-r--r--

Revert simplistic fix pending revisit of Mozilla integration attempt.

     1 <!DOCTYPE HTML>
     2 <html>
     3 <head>
     4   <title>Test for serialization and equivalence of time units</title>
     5   <script type="application/javascript" 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">
    13 </div>
    14 <pre id="test">
    15 <script type="application/javascript">
    17 /** Test for serialization and equivalence of time units **/
    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 };
    29 var p = document.getElementById("display");
    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 }
    44 </script>
    45 </pre>
    46 </body>
    47 </html>

mercurial