Commit 182d18b1 authored by Rob Wu's avatar Rob Wu Committed by Rob Wu
Browse files

Bug 1948263 - Show "Moved to menu" notification after hiding r=willdurand,fluent-reviewers,bolsson

parent d3923d13
Loading
Loading
Loading
Loading
+4 −0
Changes for browser/base/content/browser-addons.js: 4 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -2787,6 +2787,10 @@ var gUnifiedExtensions = {
      "extensions.unifiedExtensions.button.always_visible",
      false
    );
    ConfirmationHint.show(
      document.getElementById("PanelUI-menu-button"),
      "confirmation-hint-extensions-button-hidden"
    );
  },

  showExtensionsButtonInToolbar() {
+28 −0
Changes for browser/components/extensions/test/browser/browser_unified_extensions_button_visibility.js: 28 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -22,6 +22,29 @@ function resetButtonVisibilityToDefault() {
  Services.prefs.clearUserPref(PREF_ALWAYS_VISIBLE);
}

async function checkAndDismissPostHideNotification(win) {
  // After hiding the extensions button, a notification is displayed for 3
  // seconds, notifying the user of "Move to menu". Check that it is shown and
  // dismiss the notification.
  info("Verifying that the 'Moved to menu' hint is shown");
  let hintElem = win.ConfirmationHint._panel;
  if (hintElem.state !== "open") {
    info("Waiting for hint to be shown");
    await BrowserTestUtils.waitForEvent(hintElem, "popupshown");
  }
  is(hintElem.state, "open", "Hint popup is open");
  is(hintElem.anchorNode.id, "PanelUI-menu-button", "Anchored to appmenu");
  is(
    win.ConfirmationHint._message.getAttribute("data-l10n-id"),
    "confirmation-hint-extensions-button-hidden",
    "Shown 'Moved to menu' notification"
  );
  let hiddenpromise = BrowserTestUtils.waitForEvent(hintElem, "popuphidden");
  hintElem.hidePopup();
  info("Waiting for hint to be dismissed");
  await hiddenpromise;
}

// Tests in this file repeatedly flips prefs. To avoid having to balance
// pushPrefEnv / popPrefEnv often, reset it once in the end.
registerCleanupFunction(resetButtonVisibilityToDefault);
@@ -86,6 +109,7 @@ add_task(async function test_hide_button_via_contextmenu() {
  );
  is(removeFromToolbar.hidden, false, "removeFromToolbar is visible");
  ok(!removeFromToolbar.hasAttribute("disabled"), "removeFromToolbar enabled");

  await closeChromeContextMenu(contextMenu.id, removeFromToolbar, win);

  info("Extensions button should hide after choosing 'Remove from Toolbar'");
@@ -94,6 +118,8 @@ add_task(async function test_hide_button_via_contextmenu() {
  info("Extensions button should also be hidden in another window");
  assertExtensionsButtonHidden(window);

  await checkAndDismissPostHideNotification(win);

  await BrowserTestUtils.closeWindow(win);
  resetButtonVisibilityToDefault();
  await SpecialPowers.popPrefEnv();
@@ -213,6 +239,8 @@ add_task(async function test_customization_button_and_menu_item_visibility() {
    assertExtensionsButtonVisible(win);
    info("The button should be hidden in windows that are not customizing");
    assertExtensionsButtonHidden();

    await checkAndDismissPostHideNotification(win);
  }

  {
+2 −0
Changes for browser/locales/en-US/browser/confirmationHints.ftl: 2 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -4,6 +4,8 @@

## Confirmation hints

# Subtle notification shown when Extensions button moves into the application menu.
confirmation-hint-extensions-button-hidden = Moved to menu
confirmation-hint-password-removed = Password removed!
confirmation-hint-page-bookmarked = Saved to bookmarks
confirmation-hint-password-created = Password saved