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_template.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_template.js')
-rw-r--r-- | devtools/client/inspector/markup/test/browser_markup_template.js | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/devtools/client/inspector/markup/test/browser_markup_template.js b/devtools/client/inspector/markup/test/browser_markup_template.js new file mode 100644 index 0000000000..8516d59346 --- /dev/null +++ b/devtools/client/inspector/markup/test/browser_markup_template.js @@ -0,0 +1,55 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +// Test the markup view displaying the content of a <template> tag. + +add_task(async function () { + const TEST_URL = + `data:text/html;charset=utf-8,` + + encodeURIComponent(` + <div id="root"> + <template> + <p>template content</p> + </template> + + <div id="template-container" style="border: 1px solid black"></div> + </div> + <script> + "use strict"; + + const template = document.querySelector("template"); + const clone = document.importNode(template.content, true); + document.querySelector("#template-container").appendChild(clone); + </script>`); + + const EXPECTED_TREE = ` + root + template + #document-fragment + p + template-container + p`; + + const { inspector } = await openInspectorForURL(TEST_URL); + const { markup } = inspector; + + await assertMarkupViewAsTree(EXPECTED_TREE, "#root", inspector); + + info("Select the p element under the template ."); + const templateFront = await getNodeFront("template", inspector); + const templateContainer = markup.getContainer(templateFront); + const documentFragmentContainer = templateContainer.getChildContainers()[0]; + const pContainer = documentFragmentContainer.getChildContainers()[0]; + + await selectNode(pContainer.node, inspector, "no-reason", false); + + const ruleView = inspector.getPanel("ruleview").view; + // We only display the style attribute. + is( + ruleView.element.querySelectorAll(".ruleview-rule").length, + 1, + "No rules are displayed for this p element" + ); +}); |