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