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.

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