summaryrefslogtreecommitdiffstats
path: root/editor/libeditor/tests/test_bug1385905.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-21 11:44:51 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-21 11:44:51 +0000
commit9e3c08db40b8916968b9f30096c7be3f00ce9647 (patch)
treea68f146d7fa01f0134297619fbe7e33db084e0aa /editor/libeditor/tests/test_bug1385905.html
parentInitial commit. (diff)
downloadthunderbird-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 'editor/libeditor/tests/test_bug1385905.html')
-rw-r--r--editor/libeditor/tests/test_bug1385905.html51
1 files changed, 51 insertions, 0 deletions
diff --git a/editor/libeditor/tests/test_bug1385905.html b/editor/libeditor/tests/test_bug1385905.html
new file mode 100644
index 0000000000..fda99ae741
--- /dev/null
+++ b/editor/libeditor/tests/test_bug1385905.html
@@ -0,0 +1,51 @@
+<!DOCTYPE html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi=id=1385905
+-->
+<html>
+<head>
+ <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=1385905">Mozilla Bug 1385905</a>
+<div id="display"></div>
+<div id="editor" contenteditable style="padding: 5px;"><div>contents</div></div>
+<pre id="test">
+</pre>
+
+<script class="testbody" type="application/javascript">
+SimpleTest.waitForExplicitFinish();
+SimpleTest.waitForFocus(() => {
+ function ensureNoPaddingBR() {
+ for (let br of document.querySelectorAll("#editor > div > br")) {
+ ok(!SpecialPowers.wrap(br).isPaddingForEmptyLastLine,
+ "padding <br> element shouldn't be used with this test");
+ }
+ }
+ document.execCommand("defaultparagraphseparator", false, "div");
+ var editor = document.getElementById("editor");
+ // Click the left blank area of the first line to set cursor to the start of "contents".
+ synthesizeMouse(editor, 3, 10, {});
+ synthesizeKey("KEY_Enter");
+ is(editor.innerHTML, "<div><br></div><div>contents</div>",
+ "Typing Enter at start of the <div> element should split the <div> element");
+ synthesizeKey("KEY_ArrowUp");
+ sendString("x");
+ is(editor.innerHTML, "<div>x<br></div><div>contents</div>",
+ "Typing 'x' at the empty <div> element should just insert 'x' into the <div> element");
+ ensureNoPaddingBR();
+ synthesizeKey("KEY_Enter");
+ is(editor.innerHTML, "<div>x</div><div><br></div><div>contents</div>",
+ "Typing Enter next to 'x' in the first <div> element should split the <div> element and inserts <br> element to a new <div> element");
+ ensureNoPaddingBR();
+ synthesizeKey("KEY_Enter");
+ is(editor.innerHTML, "<div>x</div><div><br></div><div><br></div><div>contents</div>",
+ "Typing Enter in the empty <div> should split the <div> element and inserts <br> element to a new <div> element");
+ ensureNoPaddingBR();
+ SimpleTest.finish();
+});
+</script>
+</body>
+</html>