summaryrefslogtreecommitdiffstats
path: root/devtools/client/inspector/test
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:35:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:35:29 +0000
commit59203c63bb777a3bacec32fb8830fba33540e809 (patch)
tree58298e711c0ff0575818c30485b44a2f21bf28a0 /devtools/client/inspector/test
parentAdding upstream version 126.0.1. (diff)
downloadfirefox-59203c63bb777a3bacec32fb8830fba33540e809.tar.xz
firefox-59203c63bb777a3bacec32fb8830fba33540e809.zip
Adding upstream version 127.0.upstream/127.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'devtools/client/inspector/test')
-rw-r--r--devtools/client/inspector/test/browser_inspector_picker-shift-key.js35
-rw-r--r--devtools/client/inspector/test/head.js8
2 files changed, 38 insertions, 5 deletions
diff --git a/devtools/client/inspector/test/browser_inspector_picker-shift-key.js b/devtools/client/inspector/test/browser_inspector_picker-shift-key.js
index 2eb1c04709..db1d5510e7 100644
--- a/devtools/client/inspector/test/browser_inspector_picker-shift-key.js
+++ b/devtools/client/inspector/test/browser_inspector_picker-shift-key.js
@@ -13,12 +13,18 @@ const TEST_URI = `data:text/html;charset=utf-8,
<div id="nopointer" style="pointer-events: none">Element with pointer-events: none</div>
<div id="transluscent" style="pointer-events: none;opacity: 0.1">Element with opacity of 0.1</div>
<div id="invisible" style="pointer-events: none;opacity: 0">Element with opacity of 0</div>
+ <div>
+ <header>Hello</header>
+ <div style="z-index:-1;position:relative;">
+ <span id="negative-z-index-child">ZZ</span>
+ </div>
+ </div>
</main>`;
const IS_OSX = Services.appinfo.OS === "Darwin";
add_task(async function () {
- const { inspector, toolbox } = await openInspectorForURL(TEST_URI);
-
+ const { inspector, toolbox, highlighterTestFront } =
+ await openInspectorForURL(TEST_URI);
const body = await getNodeFront("body", inspector);
is(
inspector.selection.nodeFront,
@@ -72,6 +78,31 @@ add_task(async function () {
shiftKey: true,
});
await checkElementSelected("main", inspector);
+
+ info("Shift-clicking element with negative z-index parent works");
+ await hoverElement(
+ inspector,
+ "#negative-z-index-child",
+ undefined,
+ undefined,
+ {
+ shiftKey: true,
+ }
+ );
+ is(
+ await highlighterTestFront.getHighlighterNodeTextContent(
+ "box-model-infobar-id"
+ ),
+ "#negative-z-index-child",
+ "The highlighter is shown on #negative-z-index-child"
+ );
+
+ await clickElement({
+ inspector,
+ selector: "#negative-z-index-child",
+ shiftKey: true,
+ });
+ await checkElementSelected("#negative-z-index-child", inspector);
});
async function clickElement({ selector, inspector, shiftKey }) {
diff --git a/devtools/client/inspector/test/head.js b/devtools/client/inspector/test/head.js
index cb1b00030c..73c8902c6b 100644
--- a/devtools/client/inspector/test/head.js
+++ b/devtools/client/inspector/test/head.js
@@ -131,10 +131,12 @@ function pickElement(inspector, selector, x, y) {
* X-offset from the top-left corner of the element matching the provided selector
* @param {Number} y
* Y-offset from the top-left corner of the element matching the provided selector
+ * @param {Object} eventOptions
+ * Options that will be passed to synthesizeMouse
* @return {Promise} promise that resolves when both the "picker-node-hovered" and
* "highlighter-shown" events are emitted.
*/
-async function hoverElement(inspector, selector, x, y) {
+async function hoverElement(inspector, selector, x, y, eventOptions = {}) {
const { waitForHighlighterTypeShown } = getHighlighterTestHelpers(inspector);
info(`Waiting for element "${selector}" to be hovered`);
const onHovered = inspector.toolbox.nodePicker.once("picker-node-hovered");
@@ -159,7 +161,7 @@ async function hoverElement(inspector, selector, x, y) {
if (isNaN(x) || isNaN(y)) {
BrowserTestUtils.synthesizeMouseAtCenter(
selector,
- { type: "mousemove" },
+ { ...eventOptions, type: "mousemove" },
browsingContext
);
} else {
@@ -167,7 +169,7 @@ async function hoverElement(inspector, selector, x, y) {
selector,
x,
y,
- { type: "mousemove" },
+ { ...eventOptions, type: "mousemove" },
browsingContext
);
}