browser/components/tabview/test/browser_tabview_rtl.js

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:b00a9f3e9e59
1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
3
4 // ----------
5 function test() {
6 waitForExplicitFinish();
7
8 // verify initial state
9 ok(!TabView.isVisible(), "Tab View starts hidden");
10
11 showTabView(onTabViewLoadedAndShown("ltr"));
12 }
13
14 // ----------
15 function onTabViewLoadedAndShown(dir) {
16 return function() {
17 ok(TabView.isVisible(), "Tab View is visible.");
18
19 let contentWindow = document.getElementById("tab-view").contentWindow;
20 let contentDocument = contentWindow.document;
21 is(contentDocument.documentElement.getAttribute("dir"), dir,
22 "The direction should be set to " + dir.toUpperCase());
23
24 // kick off the series
25 hideTabView(onTabViewHidden(dir));
26 };
27 }
28
29 // ----------
30 function onTabViewHidden(dir) {
31 return function() {
32 ok(!TabView.isVisible(), "Tab View is hidden.");
33
34 if (dir == "ltr") {
35 // Switch to RTL mode
36 Services.prefs.setCharPref("intl.uidirection.en-US", "rtl");
37
38 showTabView(onTabViewLoadedAndShown("rtl"));
39 } else {
40 // Switch to LTR mode
41 Services.prefs.clearUserPref("intl.uidirection.en-US");
42
43 finish();
44 }
45 };
46 }

mercurial