diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
commit | 6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch) | |
tree | a68f146d7fa01f0134297619fbe7e33db084e0aa /devtools/client/inspector/markup/test/browser_markup_tag_edit_04-backspace.js | |
parent | Initial commit. (diff) | |
download | thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.tar.xz thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.zip |
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
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_04-backspace.js | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/devtools/client/inspector/markup/test/browser_markup_tag_edit_04-backspace.js b/devtools/client/inspector/markup/test/browser_markup_tag_edit_04-backspace.js new file mode 100644 index 0000000000..7a5684ba9d --- /dev/null +++ b/devtools/client/inspector/markup/test/browser_markup_tag_edit_04-backspace.js @@ -0,0 +1,64 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// Tests that a node can be deleted from the markup-view with the backspace key. +// Also checks that after deletion the correct element is highlighted. +// The previous sibling is preferred, but the parent is a fallback. + +const HTML = `<style type="text/css"> + #pseudo::before { content: 'before'; } + #pseudo::after { content: 'after'; } + </style> + <div id="parent"> + <div id="first"></div> + <div id="second"></div> + <div id="third"></div> + </div> + <div id="only-child"> + <div id="fourth"></div> + </div> + <div id="pseudo"> + <div id="fifth"></div> + </div>`; +const TEST_URL = "data:text/html;charset=utf-8," + encodeURIComponent(HTML); + +// List of all the test cases. Each item is an object with the following props: +// - selector: the css selector of the node that should be selected +// - focusedSelector: the css selector of the node we expect to be selected as +// a result of the deletion +// - pseudo: (optional) if the focused node is actually supposed to be a pseudo element +// of the specified selector. +// Note that after each test case, undo is called. +const TEST_DATA = [ + { + selector: "#first", + focusedSelector: "#second", + }, + { + selector: "#second", + focusedSelector: "#first", + }, + { + selector: "#third", + focusedSelector: "#second", + }, + { + selector: "#fourth", + focusedSelector: "#only-child", + }, + { + selector: "#fifth", + focusedSelector: "#pseudo", + pseudo: "before", + }, +]; + +add_task(async function () { + const { inspector } = await openInspectorForURL(TEST_URL); + + for (const data of TEST_DATA) { + await checkDeleteAndSelection(inspector, "back_space", data); + } +}); |