Bug 1406191 - Cleanup browser_widget_animation.js, remove event listener and close panel correctly. r?johannh draft
authorErica Wright <ewright@mozilla.com>
Tue, 10 Oct 2017 15:59:14 -0400
changeset 678488 4221d1d383885f7a2111a947c95e45412e3c03ad
parent 677214 77a4c52e9987d2359969d7c478183b438b464744
child 735344 8c59bdb61397adf6138b894326e996b89ee70a64
push id83940
push userbmo:ewright@mozilla.com
push dateWed, 11 Oct 2017 14:07:40 +0000
reviewersjohannh
bugs1406191
milestone58.0a1
Bug 1406191 - Cleanup browser_widget_animation.js, remove event listener and close panel correctly. r?johannh MozReview-Commit-ID: 6IjrdxnWPqa
browser/components/customizableui/test/browser_widget_animation.js
--- 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);