michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: function test() { michael@0: let win; michael@0: let cw; michael@0: michael@0: let getGroupItem = function (index) { michael@0: return cw.GroupItems.groupItems[index]; michael@0: } michael@0: michael@0: let newWindow = function (test) { michael@0: newWindowWithTabView(function (tvwin) { michael@0: registerCleanupFunction(function () { michael@0: if (!tvwin.closed) michael@0: tvwin.close(); michael@0: }); michael@0: michael@0: win = tvwin; michael@0: cw = win.TabView.getContentWindow(); michael@0: michael@0: // setup group items michael@0: getGroupItem(0).setSize(200, 200, true); michael@0: createGroupItemWithBlankTabs(win, 200, 200, 300, 1); michael@0: michael@0: test(); michael@0: }); michael@0: } michael@0: michael@0: let assertNumberOfTabsInGroupItem = function (groupItem, numTabs) { michael@0: is(groupItem.getChildren().length, numTabs, michael@0: 'there are ' + numTabs + ' tabs in this groupItem'); michael@0: } michael@0: michael@0: let testDragOnHiddenGroup = function () { michael@0: let groupItem = getGroupItem(1); michael@0: michael@0: hideGroupItem(groupItem, function () { michael@0: let drag = groupItem.getChild(0).container; michael@0: let drop = groupItem.$undoContainer[0]; michael@0: michael@0: assertNumberOfTabsInGroupItem(groupItem, 1); michael@0: michael@0: EventUtils.synthesizeMouseAtCenter(drag, {type: 'mousedown'}, cw); michael@0: EventUtils.synthesizeMouseAtCenter(drop, {type: 'mousemove'}, cw); michael@0: EventUtils.synthesizeMouseAtCenter(drop, {type: 'mouseup'}, cw); michael@0: michael@0: assertNumberOfTabsInGroupItem(groupItem, 1); michael@0: michael@0: win.close(); michael@0: newWindow(testDragOnVisibleGroup); michael@0: }); michael@0: } michael@0: michael@0: let testDragOnVisibleGroup = function () { michael@0: let groupItem = getGroupItem(0); michael@0: let drag = getGroupItem(1).getChild(0).container; michael@0: let drop = groupItem.container; michael@0: michael@0: assertNumberOfTabsInGroupItem(groupItem, 1); michael@0: michael@0: EventUtils.synthesizeMouseAtCenter(drag, {type: 'mousedown'}, cw); michael@0: EventUtils.synthesizeMouseAtCenter(drop, {type: 'mousemove'}, cw); michael@0: EventUtils.synthesizeMouseAtCenter(drop, {type: 'mouseup'}, cw); michael@0: michael@0: assertNumberOfTabsInGroupItem(groupItem, 2); michael@0: michael@0: win.close(); michael@0: finish(); michael@0: } michael@0: michael@0: waitForExplicitFinish(); michael@0: newWindow(testDragOnHiddenGroup); michael@0: }