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/inert/inert-and-contenteditable.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/inert/inert-and-contenteditable.html')
-rw-r--r-- | testing/web-platform/tests/inert/inert-and-contenteditable.html | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/testing/web-platform/tests/inert/inert-and-contenteditable.html b/testing/web-platform/tests/inert/inert-and-contenteditable.html new file mode 100644 index 0000000000..01091d1736 --- /dev/null +++ b/testing/web-platform/tests/inert/inert-and-contenteditable.html @@ -0,0 +1,54 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>Inert and contenteditable</title> +<link rel="author" title="Oriol Brufau" href="mailto:obrufau@igalia.com"> +<link rel="help" href="https://html.spec.whatwg.org/multipage/interaction.html#inert"> +<link rel="help" href="https://html.spec.whatwg.org/multipage/interaction.html#attr-contenteditable"> +<meta assert="assert" content=" + Executing an editing command in a node marked as both inert and editable + should have the same result regardless of which ancestors trigger each effect. + Only testing for consistency, the exact result is not interoperable."> + +<div id="log"></div> + +<div class="wrapper" contenteditable inert> + {<p class="target">target</p>} +</div> + +<div class="wrapper" contenteditable> + {<p class="target" inert>target</p>} +</div> + +<div class="wrapper" inert> + {<p class="target" contenteditable>target</p>} +</div> + +<div class="wrapper"> + {<p class="target" contenteditable inert>target</p>} +</div> + +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script> +const results = []; +const textContents = []; +setup(function() { + const selection = getSelection(); + for (let wrapper of document.querySelectorAll(".wrapper")) { + const target = wrapper.querySelector(".target"); + selection.collapse(target.firstChild, 3); + results.push(document.execCommand("delete")); + textContents.push(wrapper.textContent.trim()); + } +}); +function testSameValues(array, description) { + test(function() { + assert_greater_than(array.length, 0, "Array shouldn't be empty"); + for (let i = 1; i < array.length; ++i) { + assert_equals(array[i], array[0], `${JSON.stringify(array)} at index ${i}`); + } + }, description); +} +testSameValues(results, "execCommand should return the same value"); +testSameValues(textContents, "The resulting textContent should be the same value"); +</script> |