browser/components/tabview/test/browser_tabview_bug696602.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/ */
     3 let win;
     5 function test() {
     6   waitForExplicitFinish();
     8   newWindowWithTabView(function(newWin) {
     9     win = newWin;
    11     registerCleanupFunction(function() {
    12       win.close();
    13     });
    15     let cw = win.TabView.getContentWindow();
    16     let groupItemOne = cw.GroupItems.groupItems[0];
    17     let groupItemTwo = createGroupItemWithBlankTabs(win, 300, 300, 20, 10);
    19     is(win.gBrowser.tabContainer.getAttribute("overflow"), "true",
    20        "The tabstrip is overflow");
    22     is(groupItemOne.getChildren().length, 10, "Group one has 10 tabs");
    23     is(groupItemTwo.getChildren().length, 10, "Group two has 10 tabs");
    25     checkSelectedTabVisible("two", function() {
    26       showTabView(function() {
    27         checkSelectedTabVisible("one", finish);
    28         groupItemOne.getChild(9).zoomIn();
    29       }, win);
    30     });
    31     groupItemTwo.getChild(9).zoomIn();
    32   }, function(newWin) {
    33     for (let i = 0; i < 9; i++)
    34       newWin.gBrowser.addTab();
    35   });
    36 }
    38 function isSelectedTabVisible() {
    39   let tabstrip = win.gBrowser.tabContainer.mTabstrip;
    40   let scrollRect = tabstrip.scrollClientRect;
    41   let tab = win.gBrowser.selectedTab.getBoundingClientRect();
    43   return (scrollRect.left <= tab.left && tab.right <= scrollRect.right);
    44 }
    46 function checkSelectedTabVisible(groupName, callback) {
    47   whenTabViewIsHidden(function() {
    48     ok(isSelectedTabVisible(), "Group " + groupName + " selected tab is visible");
    49     callback();
    50   }, win);
    51 }

mercurial