Bug 1874684 - Part 17: Fix uninitialised variable warnings from clang-tidy. r=allstarschh
[gecko.git] / editor / libeditor / tests / test_bug1619852.html
blob4564f365260e5848b01c458424601ec2690f2f5d
1 <!DOCTYPE html>
2 <!--
3 https://bugzilla.mozilla.org/show_bug.cgi?id=1619852
4 -->
5 <html>
6 <head>
7 <title>Test for Bug 1619852</title>
8 <script src="/tests/SimpleTest/SimpleTest.js"></script>
9 <script src="/tests/SimpleTest/EventUtils.js"></script>
10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
11 </head>
12 <body>
13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1619852">Bug 1619852</a>
14 <p id="display"></p>
15 <div id="content" style="display: none"></div>
16 <pre id="test"></pre>
17 <div contenteditable>abcd</div>
18 <script>
19 SimpleTest.waitForExplicitFinish();
20 SimpleTest.waitForFocus(() => {
21 let editor = document.querySelector("div[contenteditable]");
22 // Do nothing, but `HTMLEditor` may use different path to detect unexpected DOM tree or selection change.
23 editor.addEventListener("DOMNodeRemoved", () => {});
24 getSelection().collapse(editor.firstChild, 4);
25 synthesizeKey("KEY_Backspace");
26 is(editor.textContent, "abc", "The last character should've been removed by the Backspace");
27 getSelection().collapse(editor.firstChild, 1);
28 synthesizeKey("KEY_Backspace");
29 is(editor.textContent, "bc", "The first character should've been removed by the Backspace");
30 SimpleTest.finish();
31 });
32 </script>
33 </body>
34 </html>