summaryrefslogtreecommitdiffstats
path: root/browser/components/customizableui/test/browser_history_after_appMenu.js
blob: 89c4b467a27b3797427236d6a57d43a7a09527a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/* Any copyright is dedicated to the Public Domain.
 * http://creativecommons.org/publicdomain/zero/1.0/ */

"use strict";

/**
 * Checks that opening the History view using the default toolbar button works
 * also while the view is displayed in the main menu.
 */
add_task(async function test_history_after_appMenu() {
  // First add the button to the toolbar and wait for it to show up:
  CustomizableUI.addWidgetToArea("history-panelmenu", "nav-bar");
  registerCleanupFunction(() =>
    CustomizableUI.removeWidgetFromArea("history-panelmenu")
  );
  await waitForElementShown(document.getElementById("history-panelmenu"));

  let historyView = PanelMultiView.getViewNode(document, "PanelUI-history");
  // Open the main menu.
  await gCUITestUtils.openMainMenu();

  // Show the History view as a subview of the main menu.
  document.getElementById("appMenu-history-button").click();
  await BrowserTestUtils.waitForEvent(historyView, "ViewShown");

  // Show the History view as the main view of the History panel.
  document.getElementById("history-panelmenu").click();
  await BrowserTestUtils.waitForEvent(historyView, "ViewShown");

  // Close the history panel.
  let historyPanel = historyView.closest("panel");
  let promise = BrowserTestUtils.waitForEvent(historyPanel, "popuphidden");
  historyPanel.hidePopup();
  await promise;
});