browser/components/tabview/test/browser_tabview_bug634672.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 cw;
     6   let win;
     8   waitForExplicitFinish();
    10   newWindowWithTabView(function (tvwin) {
    11     win = tvwin;
    12     cw = win.TabView.getContentWindow();
    14     registerCleanupFunction(function () {
    15       if (win && !win.closed)
    16         win.close();
    17     });
    19     // fill the group item with some tabs
    20     for (let i = 0; i < 5; i++)
    21       win.gBrowser.loadOneTab("about:blank");
    23     let groupItem = cw.GroupItems.groupItems[0];
    24     groupItem.setSize(400, 400, true);
    25     let range = new cw.Range(1, 400);
    27     // determine the groupItem's largest possible stacked size
    28     while (range.extent > 1) {
    29       let pivot = Math.floor(range.extent / 2);
    30       groupItem.setSize(range.min + pivot, range.min + pivot, true);
    32       if (groupItem.isStacked())
    33         range.min += pivot;
    34       else
    35         range.max -= pivot;
    36     }
    38     // stack the group
    39     groupItem.setSize(range.min, range.min, true);
    40     ok(groupItem.isStacked(), "groupItem is stacked");
    42     // one step back to un-stack the groupItem
    43     groupItem.setSize(range.max, range.max, true);
    44     ok(!groupItem.isStacked(), "groupItem is no longer stacked");
    46     // check that close buttons are visible
    47     let tabItem = groupItem.getChild(0);
    48     isnot(tabItem.$close.css("display"), "none", "close button is visible");
    50     finish();
    51   });
    52 }

mercurial