Bug 1406191 - Cleanup browser_widget_animation.js, remove event listener and close panel correctly. r?johannh
MozReview-Commit-ID: 6IjrdxnWPqa
--- a/browser/components/customizableui/test/browser_widget_animation.js
+++ b/browser/components/customizableui/test/browser_widget_animation.js
@@ -22,35 +22,33 @@ function promiseWidgetAnimationOut(aNode
});
}
function promiseOverflowAnimationEnd() {
return new Promise(resolve => {
let overflowButton = document.getElementById("nav-bar-overflow-button");
overflowButton.addEventListener("animationend", function cleanupOverflowAnimationOut(event) {
if (event.animationName == "overflow-fade") {
- overflowButton.removeEventListener("transitionend", cleanupOverflowAnimationOut);
+ overflowButton.removeEventListener("animationend", cleanupOverflowAnimationOut);
ok(true, "The overflow button`s animationend event should have happened");
resolve();
}
});
});
}
// Right-click on the home widget, use the context menu to move it to the overflow menu.
// The home widget should animate out, and the overflow menu should animate upon adding.
add_task(async function() {
let homeButton = document.getElementById("home-button");
let contextMenu = document.getElementById("toolbar-context-menu");
let shownPromise = popupShown(contextMenu);
EventUtils.synthesizeMouseAtCenter(homeButton, {type: "contextmenu", button: 2 });
await shownPromise;
- let moveToPanel = contextMenu.querySelector(".customize-context-moveToPanel");
- if (moveToPanel) {
- moveToPanel.click();
- }
+ contextMenu.querySelector(".customize-context-moveToPanel").click();
+ await contextMenu.hidePopup();
await Promise.all([promiseWidgetAnimationOut(homeButton), promiseOverflowAnimationEnd()]);
ok(true, "The widget and overflow animations should have both happened.");
});
registerCleanupFunction(CustomizableUI.reset);