summaryrefslogtreecommitdiffstats
path: root/devtools/client/shared/test/browser_toolbar_basic.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 /devtools/client/shared/test/browser_toolbar_basic.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 'devtools/client/shared/test/browser_toolbar_basic.js')
-rw-r--r--devtools/client/shared/test/browser_toolbar_basic.js60
1 files changed, 60 insertions, 0 deletions
diff --git a/devtools/client/shared/test/browser_toolbar_basic.js b/devtools/client/shared/test/browser_toolbar_basic.js
new file mode 100644
index 000000000..12da27ab1
--- /dev/null
+++ b/devtools/client/shared/test/browser_toolbar_basic.js
@@ -0,0 +1,60 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+// Tests that the developer toolbar works properly
+
+const TEST_URI = TEST_URI_ROOT + "browser_toolbar_basic.html";
+
+add_task(function* () {
+ info("Starting browser_toolbar_basic.js");
+ yield addTab(TEST_URI);
+
+ ok(!DeveloperToolbar.visible, "DeveloperToolbar is not visible in to start");
+
+ let shown = oneTimeObserve(DeveloperToolbar.NOTIFICATIONS.SHOW);
+ document.getElementById("menu_devToolbar").doCommand();
+ yield shown;
+ ok(DeveloperToolbar.visible, "DeveloperToolbar is visible in checkOpen");
+
+ let close = document.getElementById("developer-toolbar-closebutton");
+ ok(close, "Close button exists");
+
+ let toggleToolbox =
+ document.getElementById("menu_devToolbox");
+ ok(!isChecked(toggleToolbox), "toggle toolbox button is not checked");
+
+ let target = TargetFactory.forTab(gBrowser.selectedTab);
+ yield gDevTools.showToolbox(target, "inspector");
+ ok(isChecked(toggleToolbox), "toggle toolbox button is checked");
+
+ yield addTab("about:blank");
+ info("Opened a new tab");
+
+ ok(!isChecked(toggleToolbox), "toggle toolbox button is not checked");
+
+ gBrowser.removeCurrentTab();
+
+ let hidden = oneTimeObserve(DeveloperToolbar.NOTIFICATIONS.HIDE);
+ document.getElementById("menu_devToolbar").doCommand();
+ yield hidden;
+ ok(!DeveloperToolbar.visible, "DeveloperToolbar is not visible in hidden");
+
+ shown = oneTimeObserve(DeveloperToolbar.NOTIFICATIONS.SHOW);
+ document.getElementById("menu_devToolbar").doCommand();
+ yield shown;
+ ok(DeveloperToolbar.visible, "DeveloperToolbar is visible in after open");
+
+ ok(isChecked(toggleToolbox), "toggle toolbox button is checked");
+
+ hidden = oneTimeObserve(DeveloperToolbar.NOTIFICATIONS.HIDE);
+ document.getElementById("developer-toolbar-closebutton").doCommand();
+ yield hidden;
+
+ ok(!DeveloperToolbar.visible, "DeveloperToolbar is not visible after re-close");
+});
+
+function isChecked(b) {
+ return b.getAttribute("checked") == "true";
+}