browser/base/content/test/general/browser_bug585785.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/browser/base/content/test/general/browser_bug585785.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,35 @@
     1.4 +var tab;
     1.5 +
     1.6 +function test() {
     1.7 +  waitForExplicitFinish();
     1.8 +
     1.9 +  tab = gBrowser.addTab();
    1.10 +  isnot(tab.getAttribute("fadein"), "true", "newly opened tab is yet to fade in");
    1.11 +
    1.12 +  // Try to remove the tab right before the opening animation's first frame
    1.13 +  window.mozRequestAnimationFrame(checkAnimationState);
    1.14 +}
    1.15 +
    1.16 +function checkAnimationState() {
    1.17 +  is(tab.getAttribute("fadein"), "true", "tab opening animation initiated");
    1.18 +
    1.19 +  info(window.getComputedStyle(tab).maxWidth);
    1.20 +  gBrowser.removeTab(tab, { animate: true });
    1.21 +  if (!tab.parentNode) {
    1.22 +    ok(true, "tab removed synchronously since the opening animation hasn't moved yet");
    1.23 +    finish();
    1.24 +    return;
    1.25 +  }
    1.26 +
    1.27 +  info("tab didn't close immediately, so the tab opening animation must have started moving");
    1.28 +  info("waiting for the tab to close asynchronously");
    1.29 +  tab.addEventListener("transitionend", function (event) {
    1.30 +    if (event.propertyName == "max-width") {
    1.31 +      tab.removeEventListener("transitionend", arguments.callee, false);
    1.32 +      executeSoon(function () {
    1.33 +        ok(!tab.parentNode, "tab removed asynchronously");
    1.34 +        finish();
    1.35 +      });
    1.36 +    }
    1.37 +  }, false);
    1.38 +}

mercurial