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/uievents/keyboard/modifier-keys-combinations.html | |
parent | Initial commit. (diff) | |
download | thunderbird-upstream.tar.xz thunderbird-upstream.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 'testing/web-platform/tests/uievents/keyboard/modifier-keys-combinations.html')
-rw-r--r-- | testing/web-platform/tests/uievents/keyboard/modifier-keys-combinations.html | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/testing/web-platform/tests/uievents/keyboard/modifier-keys-combinations.html b/testing/web-platform/tests/uievents/keyboard/modifier-keys-combinations.html new file mode 100644 index 0000000000..1b364ff72c --- /dev/null +++ b/testing/web-platform/tests/uievents/keyboard/modifier-keys-combinations.html @@ -0,0 +1,43 @@ +<!DOCTYPE html> +<meta charset="utf-8" /> +<title>UI Events Test: Modifier keys combinations</title> +<link rel="author" title="Manuel Rego Casasnovas" href="mailto:rego@igalia.com"> +<link rel="help" href="https://w3c.github.io/uievents/#idl-keyboardevent" /> +<meta name="assert" content="This test checks that modifier keys combinations are properly detected in 'keydown' event."> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="/resources/testdriver.js"></script> +<script src="/resources/testdriver-vendor.js"></script> +<div id="target" tabindex="0">Target</div> +<script> + const keys = { + "Shift": '\uE008' + 'y', + "Control": '\uE009' + 'y', + "Alt": '\uE00A' + 'y', + "Meta": '\uE03D' + 'y', + }; + + target.focus(); + for (const [key, code] of Object.entries(keys)) { + promise_test(() => { + return new Promise(resolve => { + target.addEventListener("keydown", (event) => { + if (event.key != key) + resolve(event); + }); + test_driver.send_keys(target, code); + }).then((event) => { + if (event.shiftKey) { + // Shift + y will send a "Y" keydown event on Chromium and Firefox, but a "y" one on WebKit. + assert_true(event.key == "y" || event.key == "Y"); + } else { + assert_equals(event.key, "y"); + } + assert_equals(event.shiftKey, key === "Shift"); + assert_equals(event.ctrlKey, key === "Control"); + assert_equals(event.altKey, key === "Alt"); + assert_equals(event.metaKey, key === "Meta"); + }); + }, `Check sending "${key} + y" key combination`); + } +</script> |