browser/components/tabview/test/browser_tabview_bug625424.js

Thu, 15 Jan 2015 15:55:04 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:55:04 +0100
branch
TOR_BUG_9701
changeset 9
a63d609f5ebe
permissions
-rw-r--r--

Back out 97036ab72558 which inappropriately compared turds to third parties.

     1 /* Any copyright is dedicated to the Public Domain.
     2    http://creativecommons.org/publicdomain/zero/1.0/ */
     4 function test() {
     5   let win;
     6   let cw;
     8   let getGroupItem = function (index) {
     9     return cw.GroupItems.groupItems[index];
    10   }
    12   let newWindow = function (test) {
    13     newWindowWithTabView(function (tvwin) {
    14       registerCleanupFunction(function () {
    15         if (!tvwin.closed)
    16           tvwin.close();
    17       });
    19       win = tvwin;
    20       cw = win.TabView.getContentWindow();
    22       // setup group items
    23       getGroupItem(0).setSize(200, 200, true);
    24       createGroupItemWithBlankTabs(win, 200, 200, 300, 1);
    26       test();
    27     });
    28   }
    30   let assertNumberOfTabsInGroupItem = function (groupItem, numTabs) {
    31     is(groupItem.getChildren().length, numTabs,
    32         'there are ' + numTabs + ' tabs in this groupItem');
    33   }
    35   let testDragOnHiddenGroup = function () {
    36     let groupItem = getGroupItem(1);
    38     hideGroupItem(groupItem, function () {
    39       let drag = groupItem.getChild(0).container;
    40       let drop = groupItem.$undoContainer[0];
    42       assertNumberOfTabsInGroupItem(groupItem, 1);
    44       EventUtils.synthesizeMouseAtCenter(drag, {type: 'mousedown'}, cw);
    45       EventUtils.synthesizeMouseAtCenter(drop, {type: 'mousemove'}, cw);
    46       EventUtils.synthesizeMouseAtCenter(drop, {type: 'mouseup'}, cw);
    48       assertNumberOfTabsInGroupItem(groupItem, 1);
    50       win.close();
    51       newWindow(testDragOnVisibleGroup);
    52     });
    53   }
    55   let testDragOnVisibleGroup = function () {
    56     let groupItem = getGroupItem(0);
    57     let drag = getGroupItem(1).getChild(0).container;
    58     let drop = groupItem.container;
    60     assertNumberOfTabsInGroupItem(groupItem, 1);
    62     EventUtils.synthesizeMouseAtCenter(drag, {type: 'mousedown'}, cw);
    63     EventUtils.synthesizeMouseAtCenter(drop, {type: 'mousemove'}, cw);
    64     EventUtils.synthesizeMouseAtCenter(drop, {type: 'mouseup'}, cw);
    66     assertNumberOfTabsInGroupItem(groupItem, 2);
    68     win.close();
    69     finish();
    70   }
    72   waitForExplicitFinish();
    73   newWindow(testDragOnHiddenGroup);
    74 }

mercurial