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_09.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 'devtools/client/inspector/markup/test/browser_markup_tag_edit_09.js')
-rw-r--r-- | devtools/client/inspector/markup/test/browser_markup_tag_edit_09.js | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/devtools/client/inspector/markup/test/browser_markup_tag_edit_09.js b/devtools/client/inspector/markup/test/browser_markup_tag_edit_09.js new file mode 100644 index 0000000000..56a7007a4d --- /dev/null +++ b/devtools/client/inspector/markup/test/browser_markup_tag_edit_09.js @@ -0,0 +1,74 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// Test that editing a mixed-case attribute preserves the case + +const TEST_URL = URL_ROOT + "doc_markup_svg_attributes.html"; + +add_task(async function () { + const { inspector } = await openInspectorForURL(TEST_URL); + + await inspector.markup.expandAll(); + await selectNode("svg", inspector); + + await testWellformedMixedCase(inspector); + await testMalformedMixedCase(inspector); +}); + +async function testWellformedMixedCase(inspector) { + info( + "Modifying a mixed-case attribute, " + + "expecting the attribute's case to be preserved" + ); + + info("Listening to markup mutations"); + const onMutated = inspector.once("markupmutation"); + + info("Focusing the viewBox attribute editor"); + const { editor } = await focusNode("svg", inspector); + const attr = editor.attrElements.get("viewBox").querySelector(".editable"); + attr.focus(); + EventUtils.sendKey("return", inspector.panelWin); + + info("Editing the attribute value and waiting for the mutation event"); + const input = inplaceEditor(attr).input; + input.value = 'viewBox="0 0 1 1"'; + EventUtils.sendKey("return", inspector.panelWin); + await onMutated; + + await assertAttributes("svg", { + viewBox: "0 0 1 1", + width: "200", + height: "200", + }); +} + +async function testMalformedMixedCase(inspector) { + info( + "Modifying a malformed, mixed-case attribute, " + + "expecting the attribute's case to be preserved" + ); + + info("Listening to markup mutations"); + const onMutated = inspector.once("markupmutation"); + + info("Focusing the viewBox attribute editor"); + const { editor } = await focusNode("svg", inspector); + const attr = editor.attrElements.get("viewBox").querySelector(".editable"); + attr.focus(); + EventUtils.sendKey("return", inspector.panelWin); + + info("Editing the attribute value and waiting for the mutation event"); + const input = inplaceEditor(attr).input; + input.value = 'viewBox="<>"'; + EventUtils.sendKey("return", inspector.panelWin); + await onMutated; + + await assertAttributes("svg", { + viewBox: "<>", + width: "200", + height: "200", + }); +} |