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 /dom/events/test/test_use_split_keypress_event_model_on_old_Office_Online_Server.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 'dom/events/test/test_use_split_keypress_event_model_on_old_Office_Online_Server.html')
-rw-r--r-- | dom/events/test/test_use_split_keypress_event_model_on_old_Office_Online_Server.html | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/dom/events/test/test_use_split_keypress_event_model_on_old_Office_Online_Server.html b/dom/events/test/test_use_split_keypress_event_model_on_old_Office_Online_Server.html new file mode 100644 index 0000000000..68f52be41d --- /dev/null +++ b/dom/events/test/test_use_split_keypress_event_model_on_old_Office_Online_Server.html @@ -0,0 +1,69 @@ +<!DOCTYPE html> +<html> +<!-- +https://bugzilla.mozilla.org/show_bug.cgi?id=1545410 +--> +<head> + <meta charset="utf-8"> + <title>Testing whether "keypress" event model is forcibly split model if the document is old Office Online Server instance</title> + <script src="/tests/SimpleTest/SimpleTest.js"></script> + <script src="/tests/SimpleTest/EventUtils.js"></script> + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> +</head> +<body> +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1545410">Bug 1545410</a> +<p id="display"></p> +<pre id="test"></pre> +<input id="input"> +<iframe id="iframe" onload="srcdocLoaded()" srcdoc='<html><body><div id="WACViewPanel_EditingElement" spellcheck="false" class="FireFox usehover WACEditing EditMode EditingSurfaceBody" style="overflow: visible; visibility: visible;"></div></body></html>'></iframe> +<script> +SimpleTest.waitForExplicitFinish(); +let waitForCheckKeyPressEventModelEvent; +function srcdocLoaded() { + waitForCheckKeyPressEventModelEvent = new Promise(resolve => { + dump(document.querySelector("iframe").contentDocument.location + "\n"); + var doc = document.querySelector("iframe").contentDocument; + SpecialPowers.addSystemEventListener(doc, "CheckKeyPressEventModel", resolve, {once: true}); + doc.getElementById("WACViewPanel_EditingElement").contentEditable = "true"; + }); +} +SimpleTest.waitForFocus(async function doTests() { + let iframe = document.getElementById("iframe"); + await waitForCheckKeyPressEventModelEvent; + iframe.contentDocument.body.firstChild.focus(); + let keypressEvent; + iframe.contentDocument.body.addEventListener("keypress", aEvent => keypressEvent = aEvent, {once: true}); + synthesizeKey("a", {}, iframe.contentWindow); + is(keypressEvent.keyCode, 0, + "keyCode value of 'a' should be 0"); + is(keypressEvent.charCode, "a".charCodeAt(0), + "charCode value of 'a' should be 'a'"); + + iframe.contentDocument.body.addEventListener("keypress", aEvent => keypressEvent = aEvent, {once: true}); + synthesizeKey("KEY_Enter", {}, iframe.contentWindow); + is(keypressEvent.keyCode, KeyboardEvent.DOM_VK_RETURN, + "keyCode value of 'Enter' should be DOM_VK_RETURN"); + is(keypressEvent.charCode, 0, + "charCode value of 'Enter' should be 0"); + + let input = document.getElementById("input"); + input.focus(); + input.addEventListener("keypress", aEvent => keypressEvent = aEvent, {once: true}); + synthesizeKey("a", {}); + is(keypressEvent.keyCode, "a".charCodeAt(0), + "keyCode value of 'a' in the parent document should be 'a'"); + is(keypressEvent.charCode, "a".charCodeAt(0), + "charCode value of 'a' in the parent document should be 'a'"); + + input.addEventListener("keypress", aEvent => keypressEvent = aEvent, {once: true}); + synthesizeKey("KEY_Enter"); + is(keypressEvent.keyCode, KeyboardEvent.DOM_VK_RETURN, + "keyCode value of 'Enter' in the parent document should be DOM_VK_RETURN"); + is(keypressEvent.charCode, KeyboardEvent.DOM_VK_RETURN, + "charCode value of 'Enter' in the parent document should be DOM_VK_RETURN"); + + SimpleTest.finish(); +}); +</script> +</body> +</html> |