diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /devtools/client/inspector/markup/test/browser_markup_tag_edit_avoid_refocus.js | |
parent | Initial commit. (diff) | |
download | firefox-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/markup/test/browser_markup_tag_edit_avoid_refocus.js | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/devtools/client/inspector/markup/test/browser_markup_tag_edit_avoid_refocus.js b/devtools/client/inspector/markup/test/browser_markup_tag_edit_avoid_refocus.js new file mode 100644 index 0000000000..ae6bd4c0ca --- /dev/null +++ b/devtools/client/inspector/markup/test/browser_markup_tag_edit_avoid_refocus.js @@ -0,0 +1,51 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// Bug 1327683 - Tests that an editable attribute is not refocused +// when the focus has been moved to an other element than the editor. + +const TEST_URL = 'data:text/html,<body class="abcd"></body>'; + +add_task(async function () { + const { inspector } = await openInspectorForURL(TEST_URL); + + await selectNode(".abcd", inspector); + await clickContainer(".abcd", inspector); + + const container = await focusNode(".abcd", inspector); + ok(container && container.editor, "The markup-container was found"); + + info("Listening for the markupmutation event"); + const nodeMutated = inspector.once("markupmutation"); + const attr = container.editor.attrElements + .get("class") + .querySelector(".editable"); + + attr.focus(); + EventUtils.sendKey("return", inspector.panelWin); + const input = inplaceEditor(attr).input; + ok(input, "Found editable field for class attribute"); + + input.value = 'class="wxyz"'; + + const onFocus = once(inspector.searchBox, "focus"); + EventUtils.synthesizeMouseAtCenter( + inspector.searchBox, + {}, + inspector.panelWin + ); + + info("Wait for the focus event on search box"); + await onFocus; + + info("Wait for the markup-mutation event"); + await nodeMutated; + + is( + inspector.panelDoc.activeElement, + inspector.searchBox, + "The currently focused element is the search box" + ); +}); |