layout/style/test/test_units_time.html

Wed, 31 Dec 2014 13:27:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 13:27:57 +0100
branch
TOR_BUG_3246
changeset 6
8bccb770b82d
permissions
-rw-r--r--

Ignore runtime configuration files generated during quality assurance.

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

mercurial