Bug 1772588 [wpt PR 34302] - [wpt] Add test for block-in-inline offsetParent., a...
[gecko.git] / editor / libeditor / tests / test_bug1102906.html
blob26b05926375a8981b48cac1e1bada17a70501a27
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=1102906
5 -->
6 <head>
7 <meta charset="utf-8">
8 <title>Test for Bug 1102906</title>
10 <script src="/tests/SimpleTest/EventUtils.js"></script>
11 <script src="/tests/SimpleTest/SimpleTest.js"></script>
13 <link rel="stylesheet" href="/tests/SimpleTest/test.css">
15 <script>
16 "use strict";
18 /* Test for Bug 1102906 */
19 /* The caret should be movable by using keyboard after drag-and-drop. */
21 SimpleTest.waitForExplicitFinish();
22 SimpleTest.waitForFocus( () => {
23 let content = document.getElementById("content");
24 let drag = document.getElementById("drag");
25 let selection = window.getSelection();
27 /* Perform drag-and-drop for an arbitrary content. The caret should be at
28 the end of the contenteditable. */
29 selection.selectAllChildren(drag);
30 synthesizeDrop(drag, content, {}, "copy");
32 let textContentAfterDrop = content.textContent;
34 /* Move the caret to the front of the contenteditable by using keyboard. */
35 for (let i = 0; i < content.textContent.length; ++i) {
36 sendKey("LEFT");
38 sendChar("!");
40 is(content.textContent, "!" + textContentAfterDrop,
41 "The exclamation mark should be inserted at the front.");
43 SimpleTest.finish();
44 });
45 </script>
46 </head>
47 <body>
48 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1102906">Mozilla Bug 1102906</a>
49 <div id="content" contenteditable="true"><span id="drag">Drag</span></div>
50 </body>
51 </html>