browser/components/tabview/test/browser_tabview_bug696602.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     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