summaryrefslogtreecommitdiffstats
path: root/browser/components/uitour/test/browser_UITour_panel_close_annotation.js
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /browser/components/uitour/test/browser_UITour_panel_close_annotation.js
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'browser/components/uitour/test/browser_UITour_panel_close_annotation.js')
-rw-r--r--browser/components/uitour/test/browser_UITour_panel_close_annotation.js153
1 files changed, 153 insertions, 0 deletions
diff --git a/browser/components/uitour/test/browser_UITour_panel_close_annotation.js b/browser/components/uitour/test/browser_UITour_panel_close_annotation.js
new file mode 100644
index 000000000..cff446573
--- /dev/null
+++ b/browser/components/uitour/test/browser_UITour_panel_close_annotation.js
@@ -0,0 +1,153 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/ */
+
+/**
+ * Tests that annotations disappear when their target is hidden.
+ */
+
+"use strict";
+
+var gTestTab;
+var gContentAPI;
+var gContentWindow;
+var highlight = document.getElementById("UITourHighlight");
+var tooltip = document.getElementById("UITourTooltip");
+
+function test() {
+ registerCleanupFunction(() => {
+ // Close the find bar in case it's open in the remaining tab
+ gBrowser.getFindBar(gBrowser.selectedTab).close();
+ });
+ UITourTest();
+}
+
+var tests = [
+ function test_highlight_move_outside_panel(done) {
+ gContentAPI.showInfo("urlbar", "test title", "test text");
+ gContentAPI.showHighlight("customize");
+ waitForElementToBeVisible(highlight, function checkPanelIsOpen() {
+ isnot(PanelUI.panel.state, "closed", "Panel should have opened");
+
+ // Move the highlight outside which should close the app menu.
+ gContentAPI.showHighlight("appMenu");
+ waitForPopupAtAnchor(highlight.parentElement, document.getElementById("PanelUI-button"), () => {
+ isnot(PanelUI.panel.state, "open",
+ "Panel should have closed after the highlight moved elsewhere.");
+ ok(tooltip.state == "showing" || tooltip.state == "open", "The info panel should have remained open");
+ done();
+ }, "Highlight should move to the appMenu button and still be visible");
+ }, "Highlight should be shown after showHighlight() for fixed panel items");
+ },
+
+ function test_highlight_panel_hideMenu(done) {
+ gContentAPI.showHighlight("customize");
+ gContentAPI.showInfo("search", "test title", "test text");
+ waitForElementToBeVisible(highlight, function checkPanelIsOpen() {
+ isnot(PanelUI.panel.state, "closed", "Panel should have opened");
+
+ // Close the app menu and make sure the highlight also disappeared.
+ gContentAPI.hideMenu("appMenu");
+ waitForElementToBeHidden(highlight, function checkPanelIsClosed() {
+ isnot(PanelUI.panel.state, "open",
+ "Panel still should have closed");
+ ok(tooltip.state == "showing" || tooltip.state == "open", "The info panel should have remained open");
+ done();
+ }, "Highlight should have disappeared when panel closed");
+ }, "Highlight should be shown after showHighlight() for fixed panel items");
+ },
+
+ function test_highlight_panel_click_find(done) {
+ gContentAPI.showHighlight("help");
+ gContentAPI.showInfo("searchIcon", "test title", "test text");
+ waitForElementToBeVisible(highlight, function checkPanelIsOpen() {
+ isnot(PanelUI.panel.state, "closed", "Panel should have opened");
+
+ // Click the find button which should close the panel.
+ let findButton = document.getElementById("find-button");
+ EventUtils.synthesizeMouseAtCenter(findButton, {});
+ waitForElementToBeHidden(highlight, function checkPanelIsClosed() {
+ isnot(PanelUI.panel.state, "open",
+ "Panel should have closed when the find bar opened");
+ ok(tooltip.state == "showing" || tooltip.state == "open", "The info panel should have remained open");
+ done();
+ }, "Highlight should have disappeared when panel closed");
+ }, "Highlight should be shown after showHighlight() for fixed panel items");
+ },
+
+ function test_highlight_info_panel_click_find(done) {
+ gContentAPI.showHighlight("help");
+ gContentAPI.showInfo("customize", "customize me!", "awesome!");
+ waitForElementToBeVisible(highlight, function checkPanelIsOpen() {
+ isnot(PanelUI.panel.state, "closed", "Panel should have opened");
+
+ // Click the find button which should close the panel.
+ let findButton = document.getElementById("find-button");
+ EventUtils.synthesizeMouseAtCenter(findButton, {});
+ waitForElementToBeHidden(highlight, function checkPanelIsClosed() {
+ isnot(PanelUI.panel.state, "open",
+ "Panel should have closed when the find bar opened");
+ waitForElementToBeHidden(tooltip, function checkTooltipIsClosed() {
+ isnot(tooltip.state, "open", "The info panel should have closed too");
+ done();
+ }, "Tooltip should hide with the menu");
+ }, "Highlight should have disappeared when panel closed");
+ }, "Highlight should be shown after showHighlight() for fixed panel items");
+ },
+
+ function test_highlight_panel_open_subview(done) {
+ gContentAPI.showHighlight("customize");
+ gContentAPI.showInfo("backForward", "test title", "test text");
+ waitForElementToBeVisible(highlight, function checkPanelIsOpen() {
+ isnot(PanelUI.panel.state, "closed", "Panel should have opened");
+
+ // Click the help button which should open the subview in the panel menu.
+ let helpButton = document.getElementById("PanelUI-help");
+ EventUtils.synthesizeMouseAtCenter(helpButton, {});
+ waitForElementToBeHidden(highlight, function highlightHidden() {
+ is(PanelUI.panel.state, "open",
+ "Panel should have stayed open when the subview opened");
+ ok(tooltip.state == "showing" || tooltip.state == "open", "The info panel should have remained open");
+ PanelUI.hide();
+ done();
+ }, "Highlight should have disappeared when the subview opened");
+ }, "Highlight should be shown after showHighlight() for fixed panel items");
+ },
+
+ function test_info_panel_open_subview(done) {
+ gContentAPI.showHighlight("urlbar");
+ gContentAPI.showInfo("customize", "customize me!", "Open a subview");
+ waitForElementToBeVisible(tooltip, function checkPanelIsOpen() {
+ isnot(PanelUI.panel.state, "closed", "Panel should have opened");
+
+ // Click the help button which should open the subview in the panel menu.
+ let helpButton = document.getElementById("PanelUI-help");
+ EventUtils.synthesizeMouseAtCenter(helpButton, {});
+ waitForElementToBeHidden(tooltip, function tooltipHidden() {
+ is(PanelUI.panel.state, "open",
+ "Panel should have stayed open when the subview opened");
+ is(highlight.parentElement.state, "open", "The highlight should have remained open");
+ PanelUI.hide();
+ done();
+ }, "Tooltip should have disappeared when the subview opened");
+ }, "Highlight should be shown after showHighlight() for fixed panel items");
+ },
+
+ function test_info_move_outside_panel(done) {
+ gContentAPI.showInfo("addons", "test title", "test text");
+ gContentAPI.showHighlight("urlbar");
+ let addonsButton = document.getElementById("add-ons-button");
+ waitForPopupAtAnchor(tooltip, addonsButton, function checkPanelIsOpen() {
+ isnot(PanelUI.panel.state, "closed", "Panel should have opened");
+
+ // Move the info panel outside which should close the app menu.
+ gContentAPI.showInfo("appMenu", "Cool menu button", "It's three lines");
+ waitForPopupAtAnchor(tooltip, document.getElementById("PanelUI-button"), () => {
+ isnot(PanelUI.panel.state, "open",
+ "Menu should have closed after the highlight moved elsewhere.");
+ is(highlight.parentElement.state, "open", "The highlight should have remained visible");
+ done();
+ }, "Tooltip should move to the appMenu button and still be visible");
+ }, "Tooltip should be shown after showInfo() for a panel item");
+ },
+
+];