summaryrefslogtreecommitdiffstats
path: root/devtools/client/inspector/markup/test/browser_markup_void_elements_html.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
commit6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch)
treea68f146d7fa01f0134297619fbe7e33db084e0aa /devtools/client/inspector/markup/test/browser_markup_void_elements_html.js
parentInitial commit. (diff)
downloadthunderbird-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 'devtools/client/inspector/markup/test/browser_markup_void_elements_html.js')
-rw-r--r--devtools/client/inspector/markup/test/browser_markup_void_elements_html.js51
1 files changed, 51 insertions, 0 deletions
diff --git a/devtools/client/inspector/markup/test/browser_markup_void_elements_html.js b/devtools/client/inspector/markup/test/browser_markup_void_elements_html.js
new file mode 100644
index 0000000000..18a6321eae
--- /dev/null
+++ b/devtools/client/inspector/markup/test/browser_markup_void_elements_html.js
@@ -0,0 +1,51 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+// Test void element display in the markupview.
+const TEST_URL = URL_ROOT + "doc_markup_void_elements.html";
+
+add_task(async function () {
+ const { inspector } = await openInspectorForURL(TEST_URL);
+ const { win } = inspector.markup;
+
+ info("check non-void element closing tag is displayed");
+ const { editor } = await getContainerForSelector("h1", inspector);
+ ok(
+ !editor.elt.classList.contains("void-element"),
+ "h1 element does not have void-element class"
+ );
+ ok(
+ !editor.elt.querySelector(".close").style.display !== "none",
+ "h1 element tag is not hidden"
+ );
+
+ info("check void element closing tag is hidden in HTML document");
+ let container = await getContainerForSelector("img", inspector);
+ ok(
+ container.editor.elt.classList.contains("void-element"),
+ "img element has the expected class"
+ );
+ let closeElement = container.editor.elt.querySelector(".close");
+ let computedStyle = win.getComputedStyle(closeElement);
+ ok(computedStyle.display === "none", "img closing tag is hidden");
+
+ info("check void element with pseudo element");
+ const hrNodeFront = await getNodeFront("hr.before", inspector);
+ container = getContainerForNodeFront(hrNodeFront, inspector);
+ ok(
+ container.editor.elt.classList.contains("void-element"),
+ "hr element has the expected class"
+ );
+ closeElement = container.editor.elt.querySelector(".close");
+ computedStyle = win.getComputedStyle(closeElement);
+ ok(computedStyle.display === "none", "hr closing tag is hidden");
+
+ info("check expanded void element closing tag is not hidden");
+ await inspector.markup.expandNode(hrNodeFront);
+ await waitForMultipleChildrenUpdates(inspector);
+ ok(container.expanded, "hr container is expanded");
+ computedStyle = win.getComputedStyle(closeElement);
+ ok(computedStyle.display === "none", "hr closing tag is not hidden anymore");
+});