browser/components/tabview/test/browser_tabview_bug644097.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_bug644097.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,40 @@
     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 +  waitForExplicitFinish();
     1.9 +
    1.10 +  newWindowWithTabView(function (win) {
    1.11 +    registerCleanupFunction(function () win.close());
    1.12 +
    1.13 +    let cw = win.TabView.getContentWindow();
    1.14 +    let groupItem = cw.GroupItems.groupItems[0];
    1.15 +
    1.16 +    // create some tabs with favIcons
    1.17 +    for (let i = 0; i < 3; i++)
    1.18 +      win.gBrowser.loadOneTab("http://mochi.test:8888/browser/browser/components/tabview/test/test_bug644097.html", {inBackground: true});
    1.19 +
    1.20 +    win.gBrowser.removeTab(win.gBrowser.tabs[0]);
    1.21 +
    1.22 +    // shrink the group until it stacks
    1.23 +    let size = 400;
    1.24 +    while (!groupItem.isStacked() && --size)
    1.25 +      groupItem.setSize(size, size, true);
    1.26 +
    1.27 +    // determine the tabItem at the top of the stack
    1.28 +    let tabItem;
    1.29 +    groupItem.getChildren().forEach(function (item) {
    1.30 +      if (groupItem.isTopOfStack(item))
    1.31 +        tabItem = item;
    1.32 +    });
    1.33 +
    1.34 +    ok(tabItem, "we found the tabItem at the top of the stack");
    1.35 +
    1.36 +    let fav = tabItem.$fav;
    1.37 +    is(fav.css("display"), "block", "the favIcon is visible");
    1.38 +    is(fav.css("left"), "0px", "the favIcon is at the left-most position");
    1.39 +    is(fav.css("top"), "0px", "the favIcon is at the top-most position");
    1.40 +
    1.41 +    finish();
    1.42 +  });
    1.43 +}

mercurial