diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
commit | 6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch) | |
tree | a68f146d7fa01f0134297619fbe7e33db084e0aa /testing/web-platform/tests/selection/textcontrols/focus.html | |
parent | Initial commit. (diff) | |
download | thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.tar.xz thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.zip |
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | testing/web-platform/tests/selection/textcontrols/focus.html | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/testing/web-platform/tests/selection/textcontrols/focus.html b/testing/web-platform/tests/selection/textcontrols/focus.html new file mode 100644 index 0000000000..8c2e0b5591 --- /dev/null +++ b/testing/web-platform/tests/selection/textcontrols/focus.html @@ -0,0 +1,43 @@ +<!DOCTYPE html> +<meta charset="utf-8"> +<title>Stop selection extension when focus changes</title> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/resources/testdriver.js"></script> +<script src="/resources/testdriver-actions.js"></script> +<script src="/resources/testdriver-vendor.js"></script> +<link rel="stylesheet" href="/fonts/ahem.css"> +<style> +#p { + font: 16px/1 Ahem; +} +</style> +<p id="p"> + Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna + aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. + Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint + occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. +</p> +<textarea id="textarea">Hello</textarea> +<script> + const selection = getSelection(); + const { p, textarea } = document.all; + document.addEventListener("selectionchange", ev => { + if (p.contains(selection.focusNode)) { + textarea.focus(); + } + }); + + promise_test(async () => { + await new test_driver.Actions() + .pointerMove(5, 5, {origin: p}) + .pointerDown() + .pointerMove(50, 50) + .pointerUp() + .send(); + assert_equals(selection.focusNode, document.body); + assert_equals(selection.focusOffset, 2); + assert_equals(selection.anchorNode, document.body); + assert_equals(selection.focusOffset, 2); + }, "focus() should cancel selection extension by pointer device"); +</script> |