fune/browser/base/content/test/general/browser_bug585785.js
Dan Banner f1eb5aaa84 Bug 1392119 - Enable the ESLint no-caller rule across mozilla-central r=standard8
MozReview-Commit-ID: JOC1330iFnh

--HG--
extra : rebase_source : 2afcb219d4a0d78f996bdc2c841456d2dccff605
2017-08-23 13:38:24 +01:00

35 lines
1.1 KiB
JavaScript

var tab;
function test() {
waitForExplicitFinish();
tab = BrowserTestUtils.addTab(gBrowser);
isnot(tab.getAttribute("fadein"), "true", "newly opened tab is yet to fade in");
// Try to remove the tab right before the opening animation's first frame
window.requestAnimationFrame(checkAnimationState);
}
function checkAnimationState() {
is(tab.getAttribute("fadein"), "true", "tab opening animation initiated");
info(window.getComputedStyle(tab).maxWidth);
gBrowser.removeTab(tab, { animate: true });
if (!tab.parentNode) {
ok(true, "tab removed synchronously since the opening animation hasn't moved yet");
finish();
return;
}
info("tab didn't close immediately, so the tab opening animation must have started moving");
info("waiting for the tab to close asynchronously");
tab.addEventListener("transitionend", function listener(event) {
if (event.propertyName == "max-width") {
tab.removeEventListener("transitionend", listener);
executeSoon(function() {
ok(!tab.parentNode, "tab removed asynchronously");
finish();
});
}
});
}