browser/components/tabview/test/browser_tabview_bug640765.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
michael@0 4 let contentWindow;
michael@0 5 let groupItem;
michael@0 6
michael@0 7 function test() {
michael@0 8 waitForExplicitFinish();
michael@0 9
michael@0 10 let newTabOne = gBrowser.addTab();
michael@0 11 let newTabTwo = gBrowser.addTab();
michael@0 12 let newTabThree = gBrowser.addTab();
michael@0 13
michael@0 14 registerCleanupFunction(function() {
michael@0 15 TabView.hide();
michael@0 16 while (gBrowser.tabs.length > 1)
michael@0 17 gBrowser.removeTab(gBrowser.tabs[0]);
michael@0 18 });
michael@0 19
michael@0 20 showTabView(function() {
michael@0 21 contentWindow = document.getElementById("tab-view").contentWindow;
michael@0 22 is(contentWindow.GroupItems.groupItems.length, 1, "Has only one group");
michael@0 23
michael@0 24 groupItem = contentWindow.GroupItems.groupItems[0];
michael@0 25
michael@0 26 whenAppTabIconAdded(groupItem, function () {
michael@0 27 whenAppTabIconAdded(groupItem, function () {
michael@0 28 whenAppTabIconAdded(groupItem, function () {
michael@0 29
michael@0 30 is(xulTabForAppTabIcon(0), newTabOne,
michael@0 31 "New tab one matches the first app tab icon in tabview");
michael@0 32 is(xulTabForAppTabIcon(1), newTabTwo,
michael@0 33 "New tab two matches the second app tab icon in tabview");
michael@0 34 is(xulTabForAppTabIcon(2), newTabThree,
michael@0 35 "New tab three matches the third app tab icon in tabview");
michael@0 36
michael@0 37 // move the last tab to the first position
michael@0 38 gBrowser.moveTabTo(newTabThree, 0);
michael@0 39 is(xulTabForAppTabIcon(0), newTabThree,
michael@0 40 "New tab three matches the first app tab icon in tabview");
michael@0 41 is(xulTabForAppTabIcon(1), newTabOne,
michael@0 42 "New tab one matches the second app tab icon in tabview");
michael@0 43 is(xulTabForAppTabIcon(2), newTabTwo,
michael@0 44 "New tab two matches the third app tab icon in tabview");
michael@0 45
michael@0 46 // move the first tab to the second position
michael@0 47 gBrowser.moveTabTo(newTabThree, 1);
michael@0 48 is(xulTabForAppTabIcon(0), newTabOne,
michael@0 49 "New tab one matches the first app tab icon in tabview");
michael@0 50 is(xulTabForAppTabIcon(1), newTabThree,
michael@0 51 "New tab three matches the second app tab icon in tabview");
michael@0 52 is(xulTabForAppTabIcon(2), newTabTwo,
michael@0 53 "New tab two matches the third app tab icon in tabview");
michael@0 54
michael@0 55 hideTabView(function() {
michael@0 56 gBrowser.removeTab(newTabOne);
michael@0 57 gBrowser.removeTab(newTabTwo);
michael@0 58 gBrowser.removeTab(newTabThree);
michael@0 59 finish();
michael@0 60 });
michael@0 61 });
michael@0 62 gBrowser.pinTab(newTabThree);
michael@0 63 });
michael@0 64 gBrowser.pinTab(newTabTwo);
michael@0 65 });
michael@0 66 gBrowser.pinTab(newTabOne);
michael@0 67 });
michael@0 68 }
michael@0 69
michael@0 70 function xulTabForAppTabIcon(index) {
michael@0 71 return contentWindow.iQ(
michael@0 72 contentWindow.iQ(".appTabIcon",
michael@0 73 groupItem.$appTabTray)[index]).data("xulTab");
michael@0 74 }
michael@0 75

mercurial