summaryrefslogtreecommitdiffstats
path: root/devtools/client/framework/test/browser_new_activation_workflow.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /devtools/client/framework/test/browser_new_activation_workflow.js
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'devtools/client/framework/test/browser_new_activation_workflow.js')
-rw-r--r--devtools/client/framework/test/browser_new_activation_workflow.js79
1 files changed, 79 insertions, 0 deletions
diff --git a/devtools/client/framework/test/browser_new_activation_workflow.js b/devtools/client/framework/test/browser_new_activation_workflow.js
new file mode 100644
index 0000000000..583e6d7ca8
--- /dev/null
+++ b/devtools/client/framework/test/browser_new_activation_workflow.js
@@ -0,0 +1,79 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/ */
+
+// Tests devtools API
+
+var toolbox;
+
+function test() {
+ addTab("about:blank").then(async function () {
+ loadWebConsole().then(function () {
+ console.log("loaded");
+ });
+ });
+}
+
+function loadWebConsole() {
+ ok(gDevTools, "gDevTools exists");
+ const tab = gBrowser.selectedTab;
+ return gDevTools
+ .showToolboxForTab(tab, { toolId: "webconsole" })
+ .then(function (aToolbox) {
+ toolbox = aToolbox;
+ checkToolLoading();
+ });
+}
+
+function checkToolLoading() {
+ is(toolbox.currentToolId, "webconsole", "The web console is selected");
+ ok(toolbox.isReady, "toolbox is ready");
+
+ selectAndCheckById("jsdebugger").then(function () {
+ selectAndCheckById("styleeditor").then(function () {
+ testToggle();
+ });
+ });
+}
+
+function selectAndCheckById(id) {
+ return toolbox.selectTool(id).then(function () {
+ const tab = toolbox.doc.getElementById("toolbox-tab-" + id);
+ is(
+ tab.classList.contains("selected"),
+ true,
+ "The " + id + " tab is selected"
+ );
+ is(
+ tab.getAttribute("aria-pressed"),
+ "true",
+ "The " + id + " tab is pressed"
+ );
+ });
+}
+
+function testToggle() {
+ toolbox.once("destroyed", async () => {
+ // Cannot reuse a target after it's destroyed.
+ gDevTools
+ .showToolboxForTab(gBrowser.selectedTab, { toolId: "styleeditor" })
+ .then(function (aToolbox) {
+ toolbox = aToolbox;
+ is(
+ toolbox.currentToolId,
+ "styleeditor",
+ "The style editor is selected"
+ );
+ finishUp();
+ });
+ });
+
+ toolbox.destroy();
+}
+
+function finishUp() {
+ toolbox.destroy().then(function () {
+ toolbox = null;
+ gBrowser.removeCurrentTab();
+ finish();
+ });
+}