browser/components/tabview/test/browser_tabview_bug630102.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/browser/components/tabview/test/browser_tabview_bug630102.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,52 @@
     1.4 +/* Any copyright is dedicated to the Public Domain.
     1.5 +   http://creativecommons.org/publicdomain/zero/1.0/ */
     1.6 +
     1.7 +function test() {
     1.8 +  let win, contentWindow, originalTab, newTab1, newTab2;
     1.9 +
    1.10 +  let partOne = function () {
    1.11 +    let groupItem = contentWindow.GroupItems.groupItems[0];
    1.12 +    let tabItems = groupItem.getChildren();
    1.13 +    is(tabItems.length, 2, "There are two tab items in that group item");
    1.14 +    is(tabItems[0].tab, originalTab, "The first tab item is linked to the first tab");
    1.15 +    is(tabItems[1].tab, newTab2, "The second tab item is linked to the second tab");
    1.16 +
    1.17 +    hideTabView(partTwo, win);
    1.18 +  };
    1.19 +
    1.20 +  let partTwo = function () {
    1.21 +    win.gBrowser.unpinTab(newTab1);
    1.22 +    showTabView(partThree, win);
    1.23 +  };
    1.24 +
    1.25 +  let partThree = function () {
    1.26 +    let tabItems = contentWindow.GroupItems.groupItems[0].getChildren();
    1.27 +    is(tabItems.length, 3, "There are three tab items in that group item");
    1.28 +    is(tabItems[0].tab, win.gBrowser.tabs[0], "The first tab item is linked to the first tab");
    1.29 +    is(tabItems[1].tab, win.gBrowser.tabs[1], "The second tab item is linked to the second tab");
    1.30 +    is(tabItems[2].tab, win.gBrowser.tabs[2], "The third tab item is linked to the third tab");
    1.31 +
    1.32 +    finish();
    1.33 +  };
    1.34 +
    1.35 +  let onLoad = function (tvwin) {
    1.36 +    win = tvwin;
    1.37 +    registerCleanupFunction(function () win.close());
    1.38 +
    1.39 +    for (let i = 0; i < 2; i++)
    1.40 +      win.gBrowser.loadOneTab("about:blank", {inBackground: true});
    1.41 +
    1.42 +    [originalTab, newTab1, newTab2] = win.gBrowser.tabs;
    1.43 +    win.gBrowser.pinTab(newTab1);
    1.44 +  };
    1.45 +
    1.46 +  let onShow = function () {
    1.47 +    contentWindow = win.TabView.getContentWindow();
    1.48 +    is(contentWindow.GroupItems.groupItems.length, 1, "There is only one group item");
    1.49 +
    1.50 +    partOne();
    1.51 +  };
    1.52 +
    1.53 +  waitForExplicitFinish();
    1.54 +  newWindowWithTabView(onShow, onLoad);
    1.55 +}

mercurial