browser/components/tabview/test/browser_tabview_bug630102.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 function test() {
     5   let win, contentWindow, originalTab, newTab1, newTab2;
     7   let partOne = function () {
     8     let groupItem = contentWindow.GroupItems.groupItems[0];
     9     let tabItems = groupItem.getChildren();
    10     is(tabItems.length, 2, "There are two tab items in that group item");
    11     is(tabItems[0].tab, originalTab, "The first tab item is linked to the first tab");
    12     is(tabItems[1].tab, newTab2, "The second tab item is linked to the second tab");
    14     hideTabView(partTwo, win);
    15   };
    17   let partTwo = function () {
    18     win.gBrowser.unpinTab(newTab1);
    19     showTabView(partThree, win);
    20   };
    22   let partThree = function () {
    23     let tabItems = contentWindow.GroupItems.groupItems[0].getChildren();
    24     is(tabItems.length, 3, "There are three tab items in that group item");
    25     is(tabItems[0].tab, win.gBrowser.tabs[0], "The first tab item is linked to the first tab");
    26     is(tabItems[1].tab, win.gBrowser.tabs[1], "The second tab item is linked to the second tab");
    27     is(tabItems[2].tab, win.gBrowser.tabs[2], "The third tab item is linked to the third tab");
    29     finish();
    30   };
    32   let onLoad = function (tvwin) {
    33     win = tvwin;
    34     registerCleanupFunction(function () win.close());
    36     for (let i = 0; i < 2; i++)
    37       win.gBrowser.loadOneTab("about:blank", {inBackground: true});
    39     [originalTab, newTab1, newTab2] = win.gBrowser.tabs;
    40     win.gBrowser.pinTab(newTab1);
    41   };
    43   let onShow = function () {
    44     contentWindow = win.TabView.getContentWindow();
    45     is(contentWindow.GroupItems.groupItems.length, 1, "There is only one group item");
    47     partOne();
    48   };
    50   waitForExplicitFinish();
    51   newWindowWithTabView(onShow, onLoad);
    52 }

mercurial