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/flexbox/test/browser_flexbox_text_nodes_are_not_inlined.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/flexbox/test/browser_flexbox_text_nodes_are_not_inlined.js | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/devtools/client/inspector/flexbox/test/browser_flexbox_text_nodes_are_not_inlined.js b/devtools/client/inspector/flexbox/test/browser_flexbox_text_nodes_are_not_inlined.js new file mode 100644 index 0000000000..2494ac1dcb --- /dev/null +++ b/devtools/client/inspector/flexbox/test/browser_flexbox_text_nodes_are_not_inlined.js @@ -0,0 +1,52 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// Test that single child text nodes that are also flex items can be selected in the +// flexbox inspector. +// This means that they are not inlined like normal single child text nodes, since +// selecting them in the flexbox inspector also means selecting them in the markup view. + +const TEST_URI = URL_ROOT + "doc_flexbox_text_nodes.html"; + +add_task(async function () { + await addTab(TEST_URI); + const { inspector, flexboxInspector } = await openLayoutView(); + const { document: doc } = flexboxInspector; + + // Select the flex container in the inspector. + const onItemsListRendered = waitForDOM( + doc, + ".layout-flexbox-wrapper .flex-item-list" + ); + await selectNode(".container.single-child", inspector); + const [flexItemList] = await onItemsListRendered; + + const items = [...flexItemList.querySelectorAll("button .objectBox")]; + is(items.length, 1, "There is 1 item displayed in the list"); + is(items[0].textContent, "#text", "The item in the list is a text node"); + + info("Click on the item to select it"); + const onFlexItemOutlineRendered = waitForDOM(doc, ".flex-outline-container"); + items[0].closest("button").click(); + const [flexOutlineContainer] = await onFlexItemOutlineRendered; + ok( + flexOutlineContainer, + "The flex outline is displayed for a single child short text node too" + ); + + ok( + inspector.selection.isTextNode(), + "The current inspector selection is the text node" + ); + + const markupContainer = inspector.markup.getContainer( + inspector.selection.nodeFront + ); + is( + markupContainer.elt.textContent, + "short text", + "This is the right text node" + ); +}); |