Bug 1874684 - Part 17: Fix uninitialised variable warnings from clang-tidy. r=allstarschh
[gecko.git] / editor / libeditor / tests / test_bug471319.html
blob5a180cb31029724c305dfb8a751af64401ed13cc
1 <!DOCTYPE HTML>
2 <!-- This Source Code Form is subject to the terms of the Mozilla Public
3 - License, v. 2.0. If a copy of the MPL was not distributed with this
4 - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
5 <html>
6 <!--
7 https://bugzilla.mozilla.org/show_bug.cgi?id=471319
8 -->
10 <head>
11 <title>Test for Bug 471319</title>
12 <script src="/tests/SimpleTest/SimpleTest.js"></script>
13 <link rel="stylesheet" href="/tests/SimpleTest/test.css">
14 </head>
16 <body onload="doTest();">
17 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=471319">Mozilla Bug 471319</a>
18 <p id="display"></p>
19 <div id="content" style="display: none">
20 </div>
22 <pre id="test">
23 <script type="application/javascript">
25 /** Test for Bug 471319 **/
27 SimpleTest.waitForExplicitFinish();
29 function doTest() {
30 let t1 = SpecialPowers.wrap($("t1"));
32 // Test 1: Undo on an empty editor - the editor should not forget about
33 // the padding <br> element for empty editor.
34 let t1Editor = t1.editor;
36 // Did the editor recognize the new padding <br> element?
37 t1Editor.undo();
38 ok(!t1.value, "<br> still recognized as padding on undo");
41 // Test 2: Redo on an empty editor - the editor should not forget about
42 // the padding <br> element for empty editor.
43 let t2 = SpecialPowers.wrap($("t2"));
44 let t2Editor = t2.editor;
46 // Did the editor recognize the new padding <br> element?
47 t2Editor.redo();
48 ok(!t2.value, "<br> still recognized as padding on redo");
51 // Test 3: Undoing a batched transaction where both end points of the
52 // transaction are the padding <br> element for empty editor - the
53 // <br> element should still be recognized as padding.
54 t1Editor.beginTransaction();
55 t1.value = "mozilla";
56 t1.value = "";
57 t1Editor.endTransaction();
58 t1Editor.undo();
59 ok(!t1.value,
60 "recreated <br> from undo transaction recognized as padding");
63 // Test 4: Redoing a batched transaction where both end points of the
64 // transaction are the padding <br> element for empty editor - the
65 // <br> element should still be recognized padding.
66 t1Editor.redo();
67 ok(!t1.value,
68 "recreated <br> from redo transaction recognized as padding");
69 SimpleTest.finish();
71 </script>
72 </pre>
74 <input type="text" id="t1" />
75 <input type="text" id="t2" />
76 </body>
77 </html>