Backed out changeset 0c01a856e4c3 (bug 1870427) as requested by Emilio CLOSED TREE
[gecko.git] / editor / libeditor / tests / test_bug1270235.html
blob1499239ae1861be682cc0d12f197c5c179f6605e
1 <!DOCTYPE html>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=1270235
5 -->
6 <head>
7 <title>Test for Bug 1270235</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 </script>
12 </head>
13 <body>
14 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1270235">Mozilla Bug 1270235</a>
15 <p id="display"></p>
16 <div id="content" style="display: none;"></div>
18 <div id="edit1" contenteditable="true"><p>AB</p></div>
19 <script type="application/javascript">
20 SimpleTest.waitForExplicitFinish();
21 SimpleTest.waitForFocus(() => {
22 let element = document.getElementById("edit1");
23 element.focus();
24 let textNode = element.firstChild.firstChild;
25 let node = textNode.splitText(0);
26 node.remove();
28 ok(!node.parentNode, "parent must be null");
30 let newRange = document.createRange();
31 newRange.setStart(node, 0);
32 newRange.setEnd(node, 0);
33 let selection = document.getSelection();
34 selection.removeAllRanges();
35 selection.addRange(newRange);
37 ok(selection.isCollapsed, "isCollapsed must be true");
39 // Don't crash by user input
40 sendString("X");
42 SimpleTest.finish();
43 });
44 </script>
45 </body>
46 </html>