summaryrefslogtreecommitdiffstats
path: root/devtools/client/debugger/test/mochitest/browser_dbg-expressions-focus.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/debugger/test/mochitest/browser_dbg-expressions-focus.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/debugger/test/mochitest/browser_dbg-expressions-focus.js')
-rw-r--r--devtools/client/debugger/test/mochitest/browser_dbg-expressions-focus.js50
1 files changed, 50 insertions, 0 deletions
diff --git a/devtools/client/debugger/test/mochitest/browser_dbg-expressions-focus.js b/devtools/client/debugger/test/mochitest/browser_dbg-expressions-focus.js
new file mode 100644
index 0000000000..ad6bfae662
--- /dev/null
+++ b/devtools/client/debugger/test/mochitest/browser_dbg-expressions-focus.js
@@ -0,0 +1,50 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
+
+// Ensures the input is displayed and focused when "+" is clicked
+
+"use strict";
+
+add_task(async function () {
+ // Start with the watch expression panel open
+ await pushPref("devtools.debugger.expressions-visible", true);
+ const dbg = await initDebugger("doc-script-switching.html");
+
+ const watchExpressionHeaderEl = findElement(dbg, "watchExpressionsHeader");
+ is(
+ watchExpressionHeaderEl.tagName,
+ "BUTTON",
+ "The accordion toggle is a proper button"
+ );
+ is(
+ watchExpressionHeaderEl.getAttribute("aria-expanded"),
+ "true",
+ "The accordion toggle is properly marked as expanded"
+ );
+
+ info("Close the panel");
+ clickDOMElement(dbg, watchExpressionHeaderEl);
+ await waitFor(() =>
+ watchExpressionHeaderEl.getAttribute("aria-expanded", "false")
+ );
+ ok(true, "The accordion toggle is properly marked as collapsed");
+
+ info("Click + to add the new expression");
+ await waitForElement(dbg, "watchExpressionsAddButton");
+ clickElement(dbg, "watchExpressionsAddButton");
+
+ await waitFor(() =>
+ watchExpressionHeaderEl.getAttribute("aria-expanded", "true")
+ );
+ ok(true, "The accordion toggle is properly marked as expanded again");
+
+ info("Check that the input element gets focused");
+ await waitForElementWithSelector(dbg, ".expression-input-container.focused");
+ ok(true, "Found the expression input container, with the focused class");
+ is(
+ dbg.win.document.activeElement.classList.contains("input-expression"),
+ true,
+ "The active element is the watch expression input"
+ );
+});