Bug 1772588 [wpt PR 34302] - [wpt] Add test for block-in-inline offsetParent., a...
[gecko.git] / editor / libeditor / tests / test_bug1109465.html
blob97bc6a71e96eefb4d80c7ee075dca0829f0fdaa1
1 <!DOCTYPE>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=1109465
5 -->
6 <head>
7 <title>Test for Bug 1109465</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 <div id="display">
14 <textarea></textarea>
15 </div>
16 <div id="content" style="display: none">
18 </div>
19 <pre id="test">
20 </pre>
22 <script class="testbody" type="application/javascript">
24 /** Test for Bug 1109465 **/
25 SimpleTest.waitForExplicitFinish();
26 SimpleTest.waitForFocus(function() {
27 var t = document.querySelector("textarea");
28 t.focus();
30 // Type foo\nbar and place the caret at the end of the last line
31 sendString("foo");
32 synthesizeKey("KEY_Enter");
33 sendString("bar");
34 synthesizeKey("KEY_ArrowUp");
35 is(t.selectionStart, 3, "Correct start of selection");
36 is(t.selectionEnd, 3, "Correct end of selection");
38 // Compose an IME string
39 var composingString = "\u306B";
40 // FYI: "compositionstart" will be dispatched automatically.
41 synthesizeCompositionChange(
42 { "composition":
43 { "string": composingString,
44 "clauses":
46 { "length": 1, "attr": COMPOSITION_ATTR_RAW_CLAUSE },
49 "caret": { "start": 1, "length": 0 },
50 });
51 synthesizeComposition({ type: "compositioncommitasis" });
52 is(t.value, "foo\u306B\nbar", "Correct value after composition");
54 // Now undo to test that the transaction merger has correctly detected the
55 // IMETextTxn.
56 synthesizeKey("Z", {accelKey: true});
57 is(t.value, "foo\nbar", "Correct value after undo");
59 SimpleTest.finish();
60 });
62 </script>
63 </body>
65 </html>