Bug 1772588 [wpt PR 34302] - [wpt] Add test for block-in-inline offsetParent., a...
[gecko.git] / editor / libeditor / tests / test_bug625452.html
blob68ff16342f63472a579dbdfeff00353547191682
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=625452
5 -->
6 <head>
7 <title>Test for Bug 625452</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=625452">Mozilla Bug 625452</a>
14 <p id="display"></p>
15 <div id="content">
16 <input>
17 </div>
18 <pre id="test">
19 <script type="application/javascript">
21 /** Test for Bug 625452 **/
22 SimpleTest.waitForExplicitFinish();
23 addLoadEvent(function() {
24 var i = document.querySelector("input");
25 var inputCount = 0;
26 i.addEventListener("input", function() { inputCount++; });
28 // test cut
29 i.focus();
30 i.value = "foo bar";
31 i.selectionStart = 0;
32 i.selectionEnd = 4;
33 synthesizeKey("X", {accelKey: true});
34 is(i.value, "bar", "Cut should work correctly");
35 is(inputCount, 1, "input event should be raised correctly");
37 // test undo
38 synthesizeKey("Z", {accelKey: true});
39 is(i.value, "foo bar", "Undo should work correctly");
40 is(inputCount, 2, "input event should be raised correctly");
42 // test redo
43 synthesizeKey("Z", {accelKey: true, shiftKey: true});
44 is(i.value, "bar", "Redo should work correctly");
45 is(inputCount, 3, "input event should be raised correctly");
47 // test delete
48 i.selectionStart = 0;
49 i.selectionEnd = 2;
50 synthesizeKey("KEY_Delete");
51 is(i.value, "r", "Delete should work correctly");
52 is(inputCount, 4, "input event should be raised correctly");
54 // test DeleteSelection(eNone)
55 i.value = "retest"; // the "r" common prefix is crucial here
56 is(inputCount, 4, "input event should not have been raised");
58 // paste is tested in test_bug596001.html
60 SimpleTest.finish();
61 });
63 </script>
64 </pre>
65 </body>
66 </html>