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_bug471722.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_bug471722.html | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/editor/libeditor/tests/test_bug471722.html b/editor/libeditor/tests/test_bug471722.html new file mode 100644 index 0000000000..188c30d245 --- /dev/null +++ b/editor/libeditor/tests/test_bug471722.html @@ -0,0 +1,74 @@ +<!DOCTYPE HTML> +<!-- This Source Code Form is subject to the terms of the Mozilla Public + - License, v. 2.0. If a copy of the MPL was not distributed with this + - file, You can obtain one at http://mozilla.org/MPL/2.0/. --> +<html> +<!-- +https://bugzilla.mozilla.org/show_bug.cgi?id=471722 +--> + +<head> + <title>Test for Bug 471722</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 onload="doTest();"> + <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=471722">Mozilla Bug 471722</a> + <p id="display"></p> + <div id="content" style="display: none"> + </div> + + <pre id="test"> + <script type="application/javascript"> + + /** Test for Bug 471722 **/ + + SimpleTest.waitForExplicitFinish(); + + function doTest() { + var t1 = $("t1"); + var editor = SpecialPowers.wrap(t1).editor; + + ok(editor, "able to get editor for the element"); + t1.focus(); + t1.select(); + + try { + // Cut the initial text in the textbox + ok(editor.canCut(), "can cut text"); + editor.cut(); + is(t1.value, "", "initial text was removed"); + + // So now we will have emptied the textfield and the editor will have + // created a padding <br> element for empty editor. + // Check the transaction is in the undo stack... + ok(editor.canUndo, "undo should be available"); + + // Undo the cut + editor.undo(); + is(t1.value, "minefield", "text reinserted"); + + // So now, the cut should be in the redo stack, so executing the redo + // will clear the text once again and reinsert the padding <br> + // element for empty editor that was removed after undo. + // This will require the editor to figure out that we have a padding + // <br> element again... + ok(editor.canRedo, "redo should be available"); + editor.redo(); + + // Did the editor notice a padding <br> element for empty editor + // reappeared? + is(t1.value, "", "editor found padding <br> element"); + } catch (e) { + ok(false, "test failed with error " + e); + } + SimpleTest.finish(); + } + </script> + </pre> + + <input type="text" value="minefield" id="t1" /> +</body> +</html> |