gecko-dev/browser/base/content/test/general/browser_bug585785.js
Felipe Gomes c48e1ed307 Bug 1355588 - Implement slide-up/down tab opening/closing animation. r=dao
This patch implements a new, preffed-off tab opening/closing animation where the tab slides up and down in place. In addition, it adjusts some tests and code that were relying on the max-width transitionend event happening. The intent of the patch is to land it preffed-off and iterate on the design in the tree

Differential Revision: https://phabricator.services.mozilla.com/D15955

--HG--
extra : moz-landing-system : lando
2019-02-01 17:35:05 +00:00

32 lines
1,009 B
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("TabAnimationEnd", function listener() {
executeSoon(function() {
ok(!tab.parentNode, "tab removed asynchronously");
finish();
});
}, {once: true});
}