4 https://bugzilla.mozilla.org/show_bug.cgi?id=629172
7 <title>Test for Bug
629172</title>
8 <script type=
"application/javascript" src=
"/MochiKit/packed.js"></script>
9 <script type=
"application/javascript" src=
"/tests/SimpleTest/SimpleTest.js"></script>
10 <script type=
"text/javascript" src=
"/tests/SimpleTest/EventUtils.js"></script>
11 <script type=
"text/javascript" src=
"/tests/SimpleTest/WindowSnapshot.js"></script>
12 <link rel=
"stylesheet" type=
"text/css" href=
"/tests/SimpleTest/test.css"/>
15 <a target=
"_blank" href=
"https://bugzilla.mozilla.org/show_bug.cgi?id=629172">Mozilla Bug
629172</a>
18 <textarea id=
"ltr-ref" style=
"display: none">test.
</textarea>
19 <textarea id=
"rtl-ref" style=
"display: none; direction: rtl">test.
</textarea>
22 <script type=
"application/javascript">
24 /** Test for Bug
629172 **/
25 SimpleTest.waitForExplicitFinish();
26 SimpleTest.waitForFocus(function() {
27 var LTRRef = document.getElementById(
"ltr-ref");
28 var RTLRef = document.getElementById(
"rtl-ref");
31 // generate the reference screenshots
32 LTRRef.style.display =
"";
33 document.body.clientWidth;
34 Screenshots.ltr = snapshotWindow(window);
35 LTRRef.parentNode.removeChild(LTRRef);
36 RTLRef.style.display =
"";
37 document.body.clientWidth;
38 Screenshots.rtl = snapshotWindow(window);
39 RTLRef.parentNode.removeChild(RTLRef);
40 Screenshots.get = function(dir, flip) {
42 return this[dir ==
"rtl" ?
"ltr" :
"rtl"];
48 function testDirection(initialDir) {
49 var t = document.createElement(
"textarea");
50 t.setAttribute(
"dir", initialDir);
52 document.getElementById(
"content").appendChild(t);
53 document.body.clientWidth;
54 var s1 = snapshotWindow(window);
55 ok(compareSnapshots(s1, Screenshots.get(initialDir, false), true)[
0],
56 "Textarea should appear correctly before switching the direction (" + initialDir +
")");
58 synthesizeKey(
"x", {accelKey: true, shiftKey: true});
60 var s2 = snapshotWindow(window);
61 ok(compareSnapshots(s2, Screenshots.get(initialDir, true), true)[
0],
62 "Textarea should appear correctly after switching the direction (" + initialDir +
")");
64 synthesizeKey(
"x", {accelKey: true, shiftKey: true});
66 var s3 = snapshotWindow(window);
67 ok(compareSnapshots(s3, Screenshots.get(initialDir, false), true)[
0],
68 "Textarea should appear correctly after switching back the direction (" + initialDir +
")");
69 t.parentNode.removeChild(t);