diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:35:49 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-15 03:35:49 +0000 |
commit | d8bbc7858622b6d9c278469aab701ca0b609cddf (patch) | |
tree | eff41dc61d9f714852212739e6b3738b82a2af87 /testing/web-platform/tests/selection/onselectionchange-on-distinct-text-controls.html | |
parent | Releasing progress-linux version 125.0.3-1~progress7.99u1. (diff) | |
download | firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.tar.xz firefox-d8bbc7858622b6d9c278469aab701ca0b609cddf.zip |
Merging upstream version 126.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/selection/onselectionchange-on-distinct-text-controls.html')
-rw-r--r-- | testing/web-platform/tests/selection/onselectionchange-on-distinct-text-controls.html | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/testing/web-platform/tests/selection/onselectionchange-on-distinct-text-controls.html b/testing/web-platform/tests/selection/onselectionchange-on-distinct-text-controls.html new file mode 100644 index 0000000000..ee26928699 --- /dev/null +++ b/testing/web-platform/tests/selection/onselectionchange-on-distinct-text-controls.html @@ -0,0 +1,47 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<link rel="help" href="https://w3c.github.io/selection-api/#selectionchange-event"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<body> +<input id="input1" value="hello"> +<input id="input2" value="world"> +<textarea id="textarea1">hello</textarea> +<textarea id="textarea2">world</textarea> +<script> + +promise_test(() => { + return (async function() { + let selectionChangeCount1 = 0; + let selectionChangeCount2 = 0; + input1.addEventListener("selectionchange", () => ++selectionChangeCount1); + input2.addEventListener("selectionchange", () => ++selectionChangeCount2); + input1.setSelectionRange(1, 2); + input1.setSelectionRange(2, 3); + input2.setSelectionRange(1, 3); + assert_equals(selectionChangeCount1, 0); + assert_equals(selectionChangeCount2, 0); + await new Promise(setTimeout); + assert_equals(selectionChangeCount1, 1); + assert_equals(selectionChangeCount2, 1); + })(); +}, "selectionchange event on each input element fires independently"); + +promise_test(() => { + return (async function() { + let selectionChangeCount1 = 0; + let selectionChangeCount2 = 0; + textarea1.addEventListener("selectionchange", () => ++selectionChangeCount1); + textarea2.addEventListener("selectionchange", () => ++selectionChangeCount2); + textarea1.setSelectionRange(1, 2); + textarea1.setSelectionRange(2, 3); + textarea2.setSelectionRange(1, 3); + assert_equals(selectionChangeCount1, 0); + assert_equals(selectionChangeCount2, 0); + await new Promise(setTimeout); + assert_equals(selectionChangeCount1, 1); + assert_equals(selectionChangeCount2, 1); + })(); +}, "selectionchange event on each textarea element fires independently"); + +</script> |