browser/components/tabview/test/browser_tabview_bug643392.js

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:0e184fddf1ad
1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
3
4 let state = {
5 windows: [{
6 tabs: [{
7 entries: [{ url: "about:mozilla" }],
8 hidden: true,
9 extData: {"tabview-tab": '{"url":"about:mozilla","groupID":1,"bounds":{"left":20,"top":20,"width":20,"height":20}}'}
10 },{
11 entries: [{ url: "about:mozilla" }],
12 hidden: false,
13 extData: {"tabview-tab": '{"url":"about:mozilla","groupID":2,"bounds":{"left":20,"top":20,"width":20,"height":20}}'},
14 }],
15 selected: 2,
16 extData: {
17 "tabview-groups": '{"nextID":3,"activeGroupId":2}',
18 "tabview-group":
19 '{"1":{"bounds":{"left":15,"top":5,"width":280,"height":232},"id":1},' +
20 '"2":{"bounds":{"left":309,"top":5,"width":267,"height":226},"id":2}}'
21 }
22 }]
23 };
24
25 function test() {
26 waitForExplicitFinish();
27
28 newWindowWithState(state, function (win) {
29 registerCleanupFunction(function () win.close());
30
31 is(win.gBrowser.tabs.length, 2, "two tabs");
32
33 let opts = {animate: true, byMouse: true};
34 win.gBrowser.removeTab(win.gBrowser.visibleTabs[0], opts);
35
36 let checkTabCount = function () {
37 if (win.gBrowser.tabs.length > 1) {
38 executeSoon(checkTabCount);
39 return;
40 }
41
42 is(win.gBrowser.tabs.length, 1, "one tab");
43
44 showTabView(function () {
45 let cw = win.TabView.getContentWindow();
46 is(cw.TabItems.items.length, 1, "one tabItem");
47
48 waitForFocus(finish);
49 }, win);
50 };
51
52 checkTabCount();
53 });
54 }

mercurial