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