browser/components/tabview/test/browser_tabview_bug685692.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 function test() {
     5   waitForExplicitFinish();
     7   newWindowWithTabView(win => {
     8     win.gBrowser.addTab("http://example.com/");
     9     win.gBrowser.addTab("http://example.com/");
    11     afterAllTabsLoaded(function() {
    12       let cw = win.TabView.getContentWindow();
    14       let groupItemOne = cw.GroupItems.groupItems[0];
    15       is(groupItemOne.getChildren().length, 3, "The number of tabs in group one is 3");
    17       // create a group with a blank tab
    18       let groupItemTwo = createGroupItemWithBlankTabs(win, 400, 400, 40, 1);
    19       is(groupItemTwo.getChildren().length, 1, "The number of tabs in group two is 1");
    21       cw.UI.setActive(groupItemOne);
    23       moveTabToAnotherGroup(win, groupItemOne.getChild(2).tab, groupItemOne, groupItemTwo, function() {
    24         moveTabToAnotherGroup(win, groupItemOne.getChild(1).tab, groupItemOne, groupItemTwo, function() {
    25           groupItemOne.close();
    26           promiseWindowClosed(win).then(finish);
    27         });
    28       });
    29     });
    30   });
    31 }
    33 function moveTabToAnotherGroup(win, targetTab, groupItemOne, groupItemTwo, callback) {
    34   hideTabView(function() {
    35     let tabCountInGroupItemOne = groupItemOne.getChildren().length;
    36     let tabCountInGroupItemTwo = groupItemTwo.getChildren().length;
    38     win.TabView.moveTabTo(targetTab, groupItemTwo.id);
    40     showTabView(function() {
    41       is(groupItemOne.getChildren().length, --tabCountInGroupItemOne, "The number of tab items in group one is decreased");
    42       is(groupItemTwo.getChildren().length, ++tabCountInGroupItemTwo, "The number of tab items in group two is increased");
    43       is(groupItemTwo.getChild(tabCountInGroupItemTwo-1).tab, targetTab, "The last tab is the moved tab");
    45       callback();
    46     }, win);
    47   }, win);
    48 }

mercurial