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 /editor/libeditor/tests/test_bug332636.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-- | editor/libeditor/tests/test_bug332636.html | 75 | ||||
-rw-r--r-- | editor/libeditor/tests/test_bug332636.html^headers^ | 1 |
2 files changed, 76 insertions, 0 deletions
diff --git a/editor/libeditor/tests/test_bug332636.html b/editor/libeditor/tests/test_bug332636.html new file mode 100644 index 0000000000..6fc255f7d6 --- /dev/null +++ b/editor/libeditor/tests/test_bug332636.html @@ -0,0 +1,75 @@ +<!DOCTYPE HTML> +<html> +<!-- +https://bugzilla.mozilla.org/show_bug.cgi?id=332636 +--> +<head> + <title>Test for Bug 332636</title> + <script src="/tests/SimpleTest/SimpleTest.js"></script> + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> + <script src="/tests/SimpleTest/EventUtils.js"></script> +</head> +<body> +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=332636">Mozilla Bug 332636</a> +<p id="display"></p> +<div id="content"> + <div id="edit0" contenteditable="true">axb</div><!-- reference: plane 0 base character --> + <div id="edit1" contenteditable="true">äb</div><!-- reference: plane 0 diacritic --> + <div id="edit2" contenteditable="true">a𐐀b</div><!-- plane 1 base character --> + <div id="edit3" contenteditable="true">a𐨏b</div><!-- plane 1 diacritic --> + + <div id="edit0b" contenteditable="true">axb</div><!-- reference: plane 0 base character --> + <div id="edit1b" contenteditable="true">äb</div><!-- reference: plane 0 diacritic --> + <div id="edit2b" contenteditable="true">a𐐀b</div><!-- plane 1 base character --> + <div id="edit3b" contenteditable="true">a𐨏b</div><!-- plane 1 diacritic --> +</div> +<pre id="test"> +<script type="application/javascript"> + +/** Test for Bug 332636 **/ + +SimpleTest.waitForExplicitFinish(); +addLoadEvent(runTest); + +function test(edit) { + edit.focus(); + var sel = window.getSelection(); + sel.collapse(edit.childNodes[0], edit.textContent.length - 1); + synthesizeKey("KEY_Backspace"); + is(edit.textContent, "ab", "The backspace key should delete the UTF-16 surrogate pair correctly"); +} + +function testWithMove(edit, offset) { + edit.focus(); + var sel = window.getSelection(); + sel.collapse(edit.childNodes[0], 0); + var i; + for (i = 0; i < offset; ++i) { + synthesizeKey("KEY_ArrowRight"); + synthesizeKey("KEY_ArrowLeft"); + synthesizeKey("KEY_ArrowRight"); + } + synthesizeKey("KEY_Backspace"); + is(edit.textContent, "ab", "The backspace key should delete the UTF-16 surrogate pair correctly"); +} + +function runTest() { + /* test backspace-deletion of the middle character */ + test(document.getElementById("edit0")); + test(document.getElementById("edit1")); + test(document.getElementById("edit2")); + test(document.getElementById("edit3")); + + /* extra tests with the use of RIGHT and LEFT to get to the right place */ + testWithMove(document.getElementById("edit0b"), 2); + testWithMove(document.getElementById("edit1b"), 1); + testWithMove(document.getElementById("edit2b"), 2); + testWithMove(document.getElementById("edit3b"), 1); + + SimpleTest.finish(); +} + +</script> +</pre> +</body> +</html> diff --git a/editor/libeditor/tests/test_bug332636.html^headers^ b/editor/libeditor/tests/test_bug332636.html^headers^ new file mode 100644 index 0000000000..e853d6cee5 --- /dev/null +++ b/editor/libeditor/tests/test_bug332636.html^headers^ @@ -0,0 +1 @@ +Content-Type: text/html; charset=UTF-8 |