browser/components/tabview/test/browser_tabview_rtl.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 /* Any copyright is dedicated to the Public Domain.
     2    http://creativecommons.org/publicdomain/zero/1.0/ */
     4 // ----------
     5 function test() {
     6   waitForExplicitFinish();
     8   // verify initial state
     9   ok(!TabView.isVisible(), "Tab View starts hidden");
    11   showTabView(onTabViewLoadedAndShown("ltr"));
    12 }
    14 // ----------
    15 function onTabViewLoadedAndShown(dir) {
    16   return function() {
    17     ok(TabView.isVisible(), "Tab View is visible.");
    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());
    24     // kick off the series
    25     hideTabView(onTabViewHidden(dir));
    26   };
    27 }
    29 // ---------- 
    30 function onTabViewHidden(dir) {
    31   return function() {
    32     ok(!TabView.isVisible(), "Tab View is hidden.");
    34     if (dir == "ltr") {
    35       // Switch to RTL mode
    36       Services.prefs.setCharPref("intl.uidirection.en-US", "rtl");
    38       showTabView(onTabViewLoadedAndShown("rtl"));
    39     } else {
    40       // Switch to LTR mode
    41       Services.prefs.clearUserPref("intl.uidirection.en-US");
    43       finish();
    44     }
    45   };
    46 }

mercurial