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.

     1 /* Any copyright is dedicated to the Public Domain.
     2    http://creativecommons.org/publicdomain/zero/1.0/ */
     4 let contentWindow;
     5 let groupItem;
     7 function test() {
     8   waitForExplicitFinish();
    10   let newTabOne = gBrowser.addTab();
    11   let newTabTwo = gBrowser.addTab();
    12   let newTabThree = gBrowser.addTab();
    14   registerCleanupFunction(function() {
    15     TabView.hide();
    16     while (gBrowser.tabs.length > 1)
    17       gBrowser.removeTab(gBrowser.tabs[0]);
    18   });
    20   showTabView(function() {
    21     contentWindow = document.getElementById("tab-view").contentWindow;
    22     is(contentWindow.GroupItems.groupItems.length, 1, "Has only one group");
    24     groupItem = contentWindow.GroupItems.groupItems[0];
    26     whenAppTabIconAdded(groupItem, function () {
    27       whenAppTabIconAdded(groupItem, function () {
    28         whenAppTabIconAdded(groupItem, function () {
    30           is(xulTabForAppTabIcon(0), newTabOne,
    31             "New tab one matches the first app tab icon in tabview");
    32           is(xulTabForAppTabIcon(1), newTabTwo,
    33             "New tab two matches the second app tab icon in tabview");
    34           is(xulTabForAppTabIcon(2), newTabThree,
    35             "New tab three matches the third app tab icon in tabview");
    37           // move the last tab to the first position
    38           gBrowser.moveTabTo(newTabThree, 0);
    39           is(xulTabForAppTabIcon(0), newTabThree,
    40             "New tab three matches the first app tab icon in tabview");
    41           is(xulTabForAppTabIcon(1), newTabOne,
    42             "New tab one matches the second app tab icon in tabview");
    43           is(xulTabForAppTabIcon(2), newTabTwo,
    44             "New tab two matches the third app tab icon in tabview");
    46           // move the first tab to the second position
    47           gBrowser.moveTabTo(newTabThree, 1);
    48           is(xulTabForAppTabIcon(0), newTabOne,
    49             "New tab one matches the first app tab icon in tabview");
    50           is(xulTabForAppTabIcon(1), newTabThree,
    51             "New tab three matches the second app tab icon in tabview");
    52           is(xulTabForAppTabIcon(2), newTabTwo,
    53             "New tab two matches the third app tab icon in tabview");
    55           hideTabView(function() {
    56             gBrowser.removeTab(newTabOne);
    57             gBrowser.removeTab(newTabTwo);
    58             gBrowser.removeTab(newTabThree);
    59             finish();
    60           });
    61         });
    62         gBrowser.pinTab(newTabThree);
    63       });
    64       gBrowser.pinTab(newTabTwo);
    65     });
    66     gBrowser.pinTab(newTabOne);
    67   });
    68 }
    70 function xulTabForAppTabIcon(index) {
    71     return contentWindow.iQ(
    72              contentWindow.iQ(".appTabIcon", 
    73                               groupItem.$appTabTray)[index]).data("xulTab");
    74 }

mercurial