diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
commit | 43a97878ce14b72f0981164f87f2e35e14151312 (patch) | |
tree | 620249daf56c0258faa40cbdcf9cfba06de2a846 /testing/web-platform/tests/custom-elements/form-associated/fieldset-elements.html | |
parent | Initial commit. (diff) | |
download | firefox-43a97878ce14b72f0981164f87f2e35e14151312.tar.xz firefox-43a97878ce14b72f0981164f87f2e35e14151312.zip |
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/custom-elements/form-associated/fieldset-elements.html')
-rw-r--r-- | testing/web-platform/tests/custom-elements/form-associated/fieldset-elements.html | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/testing/web-platform/tests/custom-elements/form-associated/fieldset-elements.html b/testing/web-platform/tests/custom-elements/form-associated/fieldset-elements.html new file mode 100644 index 0000000000..dc42a57b70 --- /dev/null +++ b/testing/web-platform/tests/custom-elements/form-associated/fieldset-elements.html @@ -0,0 +1,50 @@ +<!DOCTYPE html> +<body> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> + +<script> +customElements.define('custom-input-parser', class extends HTMLElement { + static get formAssociated() {return true;} +}); +</script> + +<form> + <fieldset id="fs_outer"> + <custom-input-parser name="custom-1"></custom-input> + <custom-input-upgrade name="custom-2"></custom-input> + <fieldset id="fs_inner"> + <custom-input-parser name="custom-3"></custom-input> + <custom-input-upgrade name="custom-4"></custom-input> + <uncustom-input></custom-input> + </fieldset> + </fieldset> + <custom-input-parser name="custom-5"></custom-input> + <custom-input-upgrade name="custom-6"></custom-input> +</form> + +<script> +test(() => { + const formElements = document.forms[0].elements; + const fs_outer = document.getElementById("fs_outer"); + const fs_inner = document.getElementById("fs_inner"); + + assert_array_equals(fs_inner.elements, [formElements['custom-3']], + "The items in the collection must be children of the inner fieldset element."); + assert_array_equals(fs_outer.elements, [formElements['custom-1'], fs_inner, formElements['custom-3']], + "The items in the collection must be descendants of the outer fieldset element."); + + customElements.define('custom-input-upgrade', class extends HTMLElement { + static get formAssociated() {return true;} + }); + + assert_array_equals(fs_inner.elements, [formElements['custom-3'], formElements['custom-4']], + "The items in the collection must be children of the inner fieldset element."); + assert_array_equals(fs_outer.elements, + [formElements['custom-1'], formElements['custom-2'], fs_inner, formElements['custom-3'], formElements['custom-4']], + "The items in the collection must be descendants of the outer fieldset element."); + +}, 'Form associated custom elements should work with fieldset.elements'); + +</script> +</body> |