test_transitions_and_restyles.html 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <!DOCTYPE HTML>
  2. <html>
  3. <!--
  4. https://bugzilla.mozilla.org/show_bug.cgi?id=1030993
  5. -->
  6. <head>
  7. <meta charset="utf-8">
  8. <title>Test for Bug 1030993</title>
  9. <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
  10. <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
  11. <style>
  12. #display {
  13. background: blue; height: 10px; width: 0; color: black;
  14. transition: width linear 1s, color linear 1s;
  15. }
  16. </style>
  17. </head>
  18. <body>
  19. <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1030993">Mozilla Bug 1030993</a>
  20. <p id="display"></p>
  21. <pre id="test">
  22. </pre>
  23. <script type="application/javascript">
  24. /** Test for Bug 1030993 **/
  25. function advance_clock(milliseconds) {
  26. SpecialPowers.DOMWindowUtils.advanceTimeAndRefresh(milliseconds);
  27. }
  28. var p = document.getElementById("display");
  29. var cs = getComputedStyle(p, "");
  30. advance_clock(0);
  31. cs.width; // flush
  32. p.style.width = "1000px"; // initiate transition
  33. is(cs.width, "0px", "transition at 0ms"); // flush (and test)
  34. advance_clock(100);
  35. is(cs.width, "100px", "transition at 100ms"); // flush
  36. // restyle *and* trigger new transitions
  37. p.style.color = "blue";
  38. // flush again, at the same timestamp
  39. is(cs.width, "100px", "transition at 100ms, after restyle");
  40. SpecialPowers.DOMWindowUtils.restoreNormalRefresh();
  41. </script>
  42. </body>
  43. </html>