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

michael@0 1 /* Any copyright is dedicated to the Public Domain.
michael@0 2 http://creativecommons.org/publicdomain/zero/1.0/ */
michael@0 3 let win;
michael@0 4
michael@0 5 function test() {
michael@0 6 waitForExplicitFinish();
michael@0 7
michael@0 8 newWindowWithTabView(function(newWin) {
michael@0 9 win = newWin;
michael@0 10
michael@0 11 registerCleanupFunction(function() {
michael@0 12 win.close();
michael@0 13 });
michael@0 14
michael@0 15 let cw = win.TabView.getContentWindow();
michael@0 16 let groupItemOne = cw.GroupItems.groupItems[0];
michael@0 17 let groupItemTwo = createGroupItemWithBlankTabs(win, 300, 300, 20, 10);
michael@0 18
michael@0 19 is(win.gBrowser.tabContainer.getAttribute("overflow"), "true",
michael@0 20 "The tabstrip is overflow");
michael@0 21
michael@0 22 is(groupItemOne.getChildren().length, 10, "Group one has 10 tabs");
michael@0 23 is(groupItemTwo.getChildren().length, 10, "Group two has 10 tabs");
michael@0 24
michael@0 25 checkSelectedTabVisible("two", function() {
michael@0 26 showTabView(function() {
michael@0 27 checkSelectedTabVisible("one", finish);
michael@0 28 groupItemOne.getChild(9).zoomIn();
michael@0 29 }, win);
michael@0 30 });
michael@0 31 groupItemTwo.getChild(9).zoomIn();
michael@0 32 }, function(newWin) {
michael@0 33 for (let i = 0; i < 9; i++)
michael@0 34 newWin.gBrowser.addTab();
michael@0 35 });
michael@0 36 }
michael@0 37
michael@0 38 function isSelectedTabVisible() {
michael@0 39 let tabstrip = win.gBrowser.tabContainer.mTabstrip;
michael@0 40 let scrollRect = tabstrip.scrollClientRect;
michael@0 41 let tab = win.gBrowser.selectedTab.getBoundingClientRect();
michael@0 42
michael@0 43 return (scrollRect.left <= tab.left && tab.right <= scrollRect.right);
michael@0 44 }
michael@0 45
michael@0 46 function checkSelectedTabVisible(groupName, callback) {
michael@0 47 whenTabViewIsHidden(function() {
michael@0 48 ok(isSelectedTabVisible(), "Group " + groupName + " selected tab is visible");
michael@0 49 callback();
michael@0 50 }, win);
michael@0 51 }

mercurial