From 59203c63bb777a3bacec32fb8830fba33540e809 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 12 Jun 2024 07:35:29 +0200 Subject: Adding upstream version 127.0. Signed-off-by: Daniel Baumann --- .../test/browser_inspector_picker-shift-key.js | 35 ++++++++++++++++++++-- devtools/client/inspector/test/head.js | 8 +++-- 2 files changed, 38 insertions(+), 5 deletions(-) (limited to 'devtools/client/inspector/test') 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,
Element with pointer-events: none
Element with opacity of 0.1
Element with opacity of 0
+
+
Hello
+
+ ZZ +
+
`; 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 ); } -- cgit v1.2.3