browser/components/tabview/test/browser_tabview_bug600812.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/browser/components/tabview/test/browser_tabview_bug600812.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,45 @@
     1.4 +/* Any copyright is dedicated to the Public Domain.
     1.5 +   http://creativecommons.org/publicdomain/zero/1.0/ */
     1.6 +
     1.7 +function test() {
     1.8 +  let cw;
     1.9 +
    1.10 +  let createGroupItem = function () {
    1.11 +    let bounds = new cw.Rect(20, 20, 150, 150);
    1.12 +    let groupItem = new cw.GroupItem([], {bounds: bounds, immediately: true});
    1.13 +
    1.14 +    cw.UI.setActive(groupItem);
    1.15 +    gBrowser.loadOneTab('about:blank', {inBackground: true});
    1.16 +
    1.17 +    return groupItem;
    1.18 +  }
    1.19 +
    1.20 +  let testVeryQuickDragAndDrop = function () {
    1.21 +    let sourceGroup = createGroupItem();
    1.22 +    let targetGroup = cw.GroupItems.groupItems[0];
    1.23 +
    1.24 +    sourceGroup.pushAway(true);
    1.25 +    targetGroup.pushAway(true);
    1.26 +
    1.27 +    let sourceTab = sourceGroup.getChild(0).container;
    1.28 +    EventUtils.synthesizeMouseAtCenter(sourceTab, {type: 'mousedown'}, cw);
    1.29 +
    1.30 +    let targetTab = targetGroup.getChild(0).container;
    1.31 +    EventUtils.synthesizeMouseAtCenter(targetTab, {type: 'mousemove'}, cw);
    1.32 +    EventUtils.synthesizeMouseAtCenter(targetTab, {type: 'mouseup'}, cw);
    1.33 +
    1.34 +    is(targetGroup.getChildren().length, 2, 'target group has two tabs');
    1.35 +    is(cw.GroupItems.groupItems.length, 1, 'sourceGroup was closed');
    1.36 +    isnot(cw.GroupItems.groupItems[0], sourceGroup, 'sourceGroup was closed');
    1.37 +
    1.38 +    targetGroup.getChild(0).close();
    1.39 +    hideTabView(finish);
    1.40 +  }
    1.41 +
    1.42 +  waitForExplicitFinish();
    1.43 +
    1.44 +  showTabView(function () {
    1.45 +    cw = TabView.getContentWindow();
    1.46 +    afterAllTabsLoaded(testVeryQuickDragAndDrop);
    1.47 +  });
    1.48 +}

mercurial