4 https://bugzilla.mozilla.org/show_bug.cgi?id=288789
7 <title>Test for Bug
288789</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" />
13 <a target=
"_blank" href=
"https://bugzilla.mozilla.org/show_bug.cgi?id=288789">Mozilla Bug
288789</a>
16 <textarea id=
"ta" dir=
"rtl">
28 <script class=
"testbody" type=
"text/javascript">
30 /** Test for Bug
288789 **/
32 SimpleTest.waitForExplicitFinish();
34 // This seems to be necessary because the selection is not set up properly otherwise
38 var textarea = $(
"ta");
40 function collapse(offset) {
41 textarea.selectionStart = offset;
42 textarea.selectionEnd = offset;
45 function testRight(offset) {
46 synthesizeKey(
"KEY_ArrowRight");
47 is(textarea.selectionStart, offset,
"Right movement broken");
50 function testLeft(offset) {
51 synthesizeKey(
"KEY_ArrowLeft");
52 is(textarea.selectionStart, offset,
"Left movement broken");
57 ok(true,
"Testing forward movement in RTL mode");
58 for (var i =
0; i < textarea.textContent.length; ++i) {
62 if (textarea.textContent[i] == 'a') {
67 if (i == textarea.textContent.length -
1) {
71 ok(true,
"Testing backward movement in RTL mode");
72 for (var i = textarea.textContent.length; i
> 0; --i) {
73 if (i == textarea.textContent.length) {
76 if (i
> 0 && textarea.textContent[i -
1] == 'a') {
89 ok(true,
"Testing forward movement in LTR mode");
90 for (var i =
0; i < textarea.textContent.length; ++i) {
95 if (i == textarea.textContent.length -
1) {
99 ok(true,
"Testing backward movement in LTR mode");
100 for (var i = textarea.textContent.length; i
> 0; --i) {
101 if (i == textarea.textContent.length) {