summaryrefslogtreecommitdiffstats
path: root/dom/tests/mochitest/webcomponents
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:35:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:35:29 +0000
commit59203c63bb777a3bacec32fb8830fba33540e809 (patch)
tree58298e711c0ff0575818c30485b44a2f21bf28a0 /dom/tests/mochitest/webcomponents
parentAdding upstream version 126.0.1. (diff)
downloadfirefox-59203c63bb777a3bacec32fb8830fba33540e809.tar.xz
firefox-59203c63bb777a3bacec32fb8830fba33540e809.zip
Adding upstream version 127.0.upstream/127.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/tests/mochitest/webcomponents')
-rw-r--r--dom/tests/mochitest/webcomponents/chrome.toml2
-rw-r--r--dom/tests/mochitest/webcomponents/test_custom_element_auto_import.html (renamed from dom/tests/mochitest/webcomponents/test_custom_element_ensure_custom_element.html)34
2 files changed, 15 insertions, 21 deletions
diff --git a/dom/tests/mochitest/webcomponents/chrome.toml b/dom/tests/mochitest/webcomponents/chrome.toml
index b29df619c4..5db7f14a37 100644
--- a/dom/tests/mochitest/webcomponents/chrome.toml
+++ b/dom/tests/mochitest/webcomponents/chrome.toml
@@ -1,7 +1,7 @@
[DEFAULT]
support-files = ["dummy_page.html"]
-["test_custom_element_ensure_custom_element.html"]
+["test_custom_element_auto_import.html"]
["test_custom_element_htmlconstructor_chrome.html"]
support-files = [
diff --git a/dom/tests/mochitest/webcomponents/test_custom_element_ensure_custom_element.html b/dom/tests/mochitest/webcomponents/test_custom_element_auto_import.html
index 03ed2e3815..2371600677 100644
--- a/dom/tests/mochitest/webcomponents/test_custom_element_ensure_custom_element.html
+++ b/dom/tests/mochitest/webcomponents/test_custom_element_auto_import.html
@@ -1,11 +1,8 @@
<!DOCTYPE HTML>
<html lang="en">
- <!--
- https://bugzilla.mozilla.org/show_bug.cgi?id=1813077
- -->
<head>
<meta charset="utf-8">
- <title>Test for customElements.ensureCustomElement</title>
+ <title>Test for custom element auto import behavior</title>
<script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
<script>
@@ -14,36 +11,33 @@
outside of the task that imported them. This can create issues if writing
another test in this file.
*/
- add_task(async function test_ensure_custom_elements() {
+ add_task(async function test_custom_elements_auto_import() {
let registry = SpecialPowers.wrap(customElements);
- ok(window.ensureCustomElements, "should be defined");
// Ensure the custom elements from ESModules are not defined.
is(registry.get("moz-button-group"), undefined, "moz-button-group should be undefined since we have not yet imported it");
is(registry.get("moz-support-link"), undefined, "moz-support-link should be undefined since we have not yet imported it");
is(registry.get("moz-toggle"), undefined, "moz-toggle should be undefined since we have not yet imported it");
- // Import a single custom element and assert it exists in the custom
- // element registry
- let modules = await window.ensureCustomElements("moz-support-link");
- ok(registry.get("moz-support-link"), "moz-support-link should be defined after importing it");
- is(modules, null, "There should not be a return value when using ensureCustomElements");
+ // Create a custom element and assert that it gets imported/defined.
+ document.createElement("moz-support-link");
+ ok(registry.get("moz-support-link"), "moz-support-link should be defined after creation");
- // Import multiple custom elements and assert they exist in the registry
- modules = undefined;
+ // Create multiple custom elements and assert they exist in the registry.
is(registry.get("moz-button-group"), undefined, "moz-button-group should be undefined since we have not yet imported it");
is(registry.get("moz-toggle"), undefined, "moz-toggle should be undefined since we have not yet imported it")
- modules = await window.ensureCustomElements("moz-toggle", "moz-button-group");
- is(modules, null, "There should not be a return value when using ensureCustomElements");
+
+ document.createElement("moz-button-group");
+ document.createElement("moz-toggle");
+
ok(registry.get("moz-toggle"), "moz-toggle should be defined after importing it");
ok(registry.get("moz-button-group"), "moz-button-group should be defined after importing it");
- // Ensure there are no errors if the imported elements are imported
- // again
- modules = undefined;
- modules = await window.ensureCustomElements("moz-support-link", "moz-toggle", "moz-button-group");
+ // Ensure there are no errors if the imported elements are created again.
+ document.createElement("moz-support-link");
+ document.createElement("moz-button-group");
+ document.createElement("moz-toggle");
ok(true, "The custom elements should not throw an error if imported again");
- is(modules, null, "There should not be a return value when using ensureCustomElements");
})
</script>
</head>