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_05.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_05.js')
-rw-r--r-- | devtools/client/inspector/markup/test/browser_markup_tag_edit_05.js | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/devtools/client/inspector/markup/test/browser_markup_tag_edit_05.js b/devtools/client/inspector/markup/test/browser_markup_tag_edit_05.js new file mode 100644 index 0000000000..37a2d2b4c3 --- /dev/null +++ b/devtools/client/inspector/markup/test/browser_markup_tag_edit_05.js @@ -0,0 +1,85 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ +/* import-globals-from helper_attributes_test_runner.js */ +"use strict"; + +// Tests that adding various types of attributes to nodes in the markup-view +// works as expected. Also checks that the changes are properly undoable and +// redoable. For each step in the test, we: +// - Create a new DIV +// - Make the change, check that the change was made as we expect +// - Undo the change, check that the node is back in its original state +// - Redo the change, check that the node change was made again correctly. + +loadHelperScript("helper_attributes_test_runner.js"); + +var TEST_URL = "data:text/html,<div>markup-view attributes addition test</div>"; +var TEST_DATA = [ + { + desc: 'Add an attribute value without closing "', + text: 'style="display: block;', + expectedAttributes: { + style: "display: block;", + }, + }, + { + desc: "Add an attribute value without closing '", + text: "style='display: inline;", + expectedAttributes: { + style: "display: inline;", + }, + }, + { + desc: "Add an attribute wrapped with with double quotes double quote in it", + text: 'style="display: "inline', + expectedAttributes: { + style: "display: ", + inline: "", + }, + }, + { + desc: "Add an attribute wrapped with single quotes with single quote in it", + text: "style='display: 'inline", + expectedAttributes: { + style: "display: ", + inline: "", + }, + }, + { + desc: "Add an attribute with no value", + text: "disabled", + expectedAttributes: { + disabled: "", + }, + }, + { + desc: "Add multiple attributes with no value", + text: "disabled autofocus", + expectedAttributes: { + disabled: "", + autofocus: "", + }, + }, + { + desc: "Add multiple attributes with no value, and some with value", + text: "disabled name='name' data-test='test' autofocus", + expectedAttributes: { + disabled: "", + autofocus: "", + name: "name", + "data-test": "test", + }, + }, + { + desc: "Add attribute with xmlns", + text: "xmlns:edi='http://ecommerce.example.org/schema'", + expectedAttributes: { + "xmlns:edi": "http://ecommerce.example.org/schema", + }, + }, +]; + +add_task(async function () { + const { inspector } = await openInspectorForURL(TEST_URL); + await runAddAttributesTests(TEST_DATA, "div", inspector); +}); |