Bug 1874684 - Part 17: Fix uninitialised variable warnings from clang-tidy. r=allstarschh
[gecko.git] / editor / libeditor / tests / test_bug1649005.html
blob5e08e16493ead1d2497db817c9e0ca1a63c6d9c6
1 <!DOCTYPE>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=1649005
5 -->
6 <head>
7 <meta charset="UTF-8" />
8 <title>Test for bug 1649005</title>
9 <script src="/tests/SimpleTest/SimpleTest.js"></script>
10 <link rel="stylesheet" href="/tests/SimpleTest/test.css">
11 <script src="/tests/SimpleTest/EventUtils.js"></script>
12 <script>
13 /** Test for bug 1649005, bug 1779343 **/
14 window.addEventListener("DOMContentLoaded", () => {
15 SimpleTest.waitForExplicitFinish();
16 SimpleTest.waitForFocus(function() {
17 document.body.textContent = ""; // It would be \n\n otherwise...
18 synthesizeMouseAtCenter(document.body, {});
20 var editor = getEditor();
21 is(document.body.textContent, "", "Initial body check");
22 editor.rewrap(false);
23 is(document.body.textContent, "", "Initial body check after rewrap");
25 document.body.innerHTML = "&gt;abc<br/>&gt;def<br/>&gt;ghi";
26 editor.rewrap(true);
27 is(document.body.textContent, "> abc def ghi", "Rewrapped");
29 document.body.innerHTML = "&gt; ";
30 editor.rewrap(true);
31 is(document.body.textContent, "> ", "Rewrapped half-empty string");
33 SimpleTest.finish();
34 });
35 });
37 function getEditor() {
38 var Ci = SpecialPowers.Ci;
39 var editingSession = SpecialPowers.wrap(window).docShell.editingSession;
40 var editor = editingSession.getEditorForWindow(window);
41 editor.QueryInterface(Ci.nsIHTMLEditor);
42 editor.QueryInterface(Ci.nsIEditorMailSupport);
43 editor.flags |= SpecialPowers.Ci.nsIEditor.eEditorPlaintextMask;
44 return editor;
46 </script>
47 </head>
48 <body contenteditable></body>
49 </html>