4 https://bugzilla.mozilla.org/show_bug.cgi?id=597331
7 <title>Test for Bug
597331</title>
8 <script src=
"/tests/SimpleTest/SimpleTest.js"></script>
9 <script src=
"/tests/SimpleTest/EventUtils.js"></script>
10 <script src=
"/tests/SimpleTest/WindowSnapshot.js"></script>
11 <link rel=
"stylesheet" type=
"text/css" href=
"/tests/SimpleTest/test.css"/>
13 textarea { border-color: white; }
17 <a target=
"_blank" href=
"https://bugzilla.mozilla.org/show_bug.cgi?id=597331">Mozilla Bug
597331</a>
26 <script type=
"application/javascript">
28 /** Test for Bug
597331 **/
30 SimpleTest.waitForExplicitFinish();
31 addLoadEvent(function() {
32 SimpleTest.executeSoon(function() {
33 var t = document.querySelector(
"textarea");
37 SimpleTest.executeSoon(function() {
38 t.getBoundingClientRect(); // flush layout
39 var before = snapshotWindow(window, true);
42 t.addEventListener(
"keydown", function() {
43 SimpleTest.executeSoon(function() {
44 t.style.display =
"block";
45 document.body.offsetWidth;
47 document.body.offsetWidth;
49 is(t.selectionStart,
4,
"Cursor should be moved correctly");
50 is(t.selectionEnd,
4,
"Cursor should be moved correctly");
52 var after = snapshotWindow(window, true);
54 var result = compareSnapshots(before, after, true);
55 var msg =
"The caret should be displayed correctly after reframing";
57 msg +=
"\nRESULT:\n" + result[
2];
58 msg +=
"\nREFERENCE:\n" + result[
1];
65 synthesizeKey(
"KEY_ArrowLeft");