diff -r 000000000000 -r 6474c204b198 browser/components/tabview/test/browser_tabview_bug600812.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/browser/components/tabview/test/browser_tabview_bug600812.js Wed Dec 31 06:09:35 2014 +0100 @@ -0,0 +1,45 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +function test() { + let cw; + + let createGroupItem = function () { + let bounds = new cw.Rect(20, 20, 150, 150); + let groupItem = new cw.GroupItem([], {bounds: bounds, immediately: true}); + + cw.UI.setActive(groupItem); + gBrowser.loadOneTab('about:blank', {inBackground: true}); + + return groupItem; + } + + let testVeryQuickDragAndDrop = function () { + let sourceGroup = createGroupItem(); + let targetGroup = cw.GroupItems.groupItems[0]; + + sourceGroup.pushAway(true); + targetGroup.pushAway(true); + + let sourceTab = sourceGroup.getChild(0).container; + EventUtils.synthesizeMouseAtCenter(sourceTab, {type: 'mousedown'}, cw); + + let targetTab = targetGroup.getChild(0).container; + EventUtils.synthesizeMouseAtCenter(targetTab, {type: 'mousemove'}, cw); + EventUtils.synthesizeMouseAtCenter(targetTab, {type: 'mouseup'}, cw); + + is(targetGroup.getChildren().length, 2, 'target group has two tabs'); + is(cw.GroupItems.groupItems.length, 1, 'sourceGroup was closed'); + isnot(cw.GroupItems.groupItems[0], sourceGroup, 'sourceGroup was closed'); + + targetGroup.getChild(0).close(); + hideTabView(finish); + } + + waitForExplicitFinish(); + + showTabView(function () { + cw = TabView.getContentWindow(); + afterAllTabsLoaded(testVeryQuickDragAndDrop); + }); +}