summaryrefslogtreecommitdiffstats
path: root/devtools/client/inspector/test/browser_inspector_highlighter-01.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/inspector/test/browser_inspector_highlighter-01.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 '')
-rw-r--r--devtools/client/inspector/test/browser_inspector_highlighter-01.js43
1 files changed, 43 insertions, 0 deletions
diff --git a/devtools/client/inspector/test/browser_inspector_highlighter-01.js b/devtools/client/inspector/test/browser_inspector_highlighter-01.js
new file mode 100644
index 0000000000..2cdf530073
--- /dev/null
+++ b/devtools/client/inspector/test/browser_inspector_highlighter-01.js
@@ -0,0 +1,43 @@
+/* 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/. */
+
+"use strict";
+
+// Test that hovering over nodes in the markup-view shows the highlighter over
+// those nodes
+add_task(async function () {
+ info("Loading the test document and opening the inspector");
+ const { inspector, highlighterTestFront } = await openInspectorForURL(
+ "data:text/html;charset=utf-8,<h1>foo</h1><span>bar</span>"
+ );
+ const { waitForHighlighterTypeShown } = getHighlighterTestHelpers(inspector);
+
+ let isVisible = !!inspector.highlighters.getActiveHighlighter(
+ inspector.highlighters.TYPES.BOXMODEL
+ );
+ ok(!isVisible, "The highlighter is hidden by default");
+
+ info("Selecting the test node");
+ await selectNode("span", inspector);
+ const container = await getContainerForSelector("h1", inspector);
+
+ const onHighlight = waitForHighlighterTypeShown(
+ inspector.highlighters.TYPES.BOXMODEL
+ );
+
+ EventUtils.synthesizeMouseAtCenter(
+ container.tagLine,
+ { type: "mousemove" },
+ inspector.markup.doc.defaultView
+ );
+ await onHighlight;
+
+ isVisible = await highlighterTestFront.isHighlighting();
+ ok(isVisible, "The highlighter is shown on a markup container hover");
+
+ ok(
+ await highlighterTestFront.assertHighlightedNode("h1"),
+ "The highlighter highlights the right node"
+ );
+});