Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
4 const DUMMY_PAGE_URL = "http://example.com/";
6 let state = {
7 windows: [{
8 tabs: [{
9 entries: [{ url: DUMMY_PAGE_URL }],
10 hidden: false,
11 attributes: {},
12 extData: {
13 "tabview-tab": '{"url":"' + DUMMY_PAGE_URL + '","groupID":1,"title":null,"active":true}'
14 }
15 },{
16 entries: [{ url: DUMMY_PAGE_URL }],
17 hidden: false,
18 attributes: {},
19 extData: {
20 "tabview-tab": '{"url":"' + DUMMY_PAGE_URL + '","groupID":1,"title":null}'
21 }
22 },{
23 entries: [{ url: DUMMY_PAGE_URL }],
24 hidden: true,
25 attributes: {},
26 extData: {
27 "tabview-tab": '{"url":"' + DUMMY_PAGE_URL + '","groupID":2,"title":null}'
28 },
29 },{
30 entries: [{ url: DUMMY_PAGE_URL }],
31 hidden: true,
32 attributes: {},
33 extData: {
34 "tabview-tab": '{"url":"' + DUMMY_PAGE_URL + '","groupID":2,"title":null,"active":true}'
35 },
36 }],
37 selected:1,
38 _closedTabs: [],
39 extData: {
40 "tabview-groups": '{"nextID":3,"activeGroupId":2,"totalNumber":2}',
41 "tabview-group":
42 '{"1":{"bounds":{"left":15,"top":28,"width":546,"height":218},' +
43 '"userSize":{"x":546,"y":218},"title":"","id":1},' +
44 '"2":{"bounds":{"left":15,"top":261,"width":546,"height":199},' +
45 '"userSize":{"x":546,"y":199},"title":"","id":2}}',
46 "tabview-ui": '{"pageBounds":{"left":0,"top":0,"width":976,"height":663}}'
47 }, sizemode:"normal"
48 }]
49 };
51 function test() {
52 waitForExplicitFinish();
54 newWindowWithState(state, function (win) {
55 registerCleanupFunction(function () win.close());
57 showTabView(function() {
58 let cw = win.TabView.getContentWindow();
59 let groupItems = cw.GroupItems.groupItems;
60 let groupOne = groupItems[0];
61 let groupTwo = groupItems[1];
63 // check the active tab of each group
64 is(groupOne.getActiveTab(), groupOne.getChild(0), "The active tab item of group one is the first one");
65 is(groupTwo.getActiveTab(), groupTwo.getChild(1), "The active tab item of group two is the second one");
67 is(cw.UI.getActiveTab(), groupOne.getChild(0), "The hightlighted tab item is the first one in group one");
68 // select a group and the second tab should be hightlighted
69 cw.UI.setActive(groupTwo);
70 is(cw.UI.getActiveTab(), groupTwo.getChild(1), "The hightlighted tab item is the second one in group two");
72 finish();
73 }, win);
74 });
75 }