michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: const DUMMY_PAGE_URL = "http://example.com/"; michael@0: michael@0: let state = { michael@0: windows: [{ michael@0: tabs: [{ michael@0: entries: [{ url: DUMMY_PAGE_URL }], michael@0: hidden: false, michael@0: attributes: {}, michael@0: extData: { michael@0: "tabview-tab": '{"url":"' + DUMMY_PAGE_URL + '","groupID":1,"title":null,"active":true}' michael@0: } michael@0: },{ michael@0: entries: [{ url: DUMMY_PAGE_URL }], michael@0: hidden: false, michael@0: attributes: {}, michael@0: extData: { michael@0: "tabview-tab": '{"url":"' + DUMMY_PAGE_URL + '","groupID":1,"title":null}' michael@0: } michael@0: },{ michael@0: entries: [{ url: DUMMY_PAGE_URL }], michael@0: hidden: true, michael@0: attributes: {}, michael@0: extData: { michael@0: "tabview-tab": '{"url":"' + DUMMY_PAGE_URL + '","groupID":2,"title":null}' michael@0: }, michael@0: },{ michael@0: entries: [{ url: DUMMY_PAGE_URL }], michael@0: hidden: true, michael@0: attributes: {}, michael@0: extData: { michael@0: "tabview-tab": '{"url":"' + DUMMY_PAGE_URL + '","groupID":2,"title":null,"active":true}' michael@0: }, michael@0: }], michael@0: selected:1, michael@0: _closedTabs: [], michael@0: extData: { michael@0: "tabview-groups": '{"nextID":3,"activeGroupId":2,"totalNumber":2}', michael@0: "tabview-group": michael@0: '{"1":{"bounds":{"left":15,"top":28,"width":546,"height":218},' + michael@0: '"userSize":{"x":546,"y":218},"title":"","id":1},' + michael@0: '"2":{"bounds":{"left":15,"top":261,"width":546,"height":199},' + michael@0: '"userSize":{"x":546,"y":199},"title":"","id":2}}', michael@0: "tabview-ui": '{"pageBounds":{"left":0,"top":0,"width":976,"height":663}}' michael@0: }, sizemode:"normal" michael@0: }] michael@0: }; michael@0: michael@0: function test() { michael@0: waitForExplicitFinish(); michael@0: michael@0: newWindowWithState(state, function (win) { michael@0: registerCleanupFunction(function () win.close()); michael@0: michael@0: showTabView(function() { michael@0: let cw = win.TabView.getContentWindow(); michael@0: let groupItems = cw.GroupItems.groupItems; michael@0: let groupOne = groupItems[0]; michael@0: let groupTwo = groupItems[1]; michael@0: michael@0: // check the active tab of each group michael@0: is(groupOne.getActiveTab(), groupOne.getChild(0), "The active tab item of group one is the first one"); michael@0: is(groupTwo.getActiveTab(), groupTwo.getChild(1), "The active tab item of group two is the second one"); michael@0: michael@0: is(cw.UI.getActiveTab(), groupOne.getChild(0), "The hightlighted tab item is the first one in group one"); michael@0: // select a group and the second tab should be hightlighted michael@0: cw.UI.setActive(groupTwo); michael@0: is(cw.UI.getActiveTab(), groupTwo.getChild(1), "The hightlighted tab item is the second one in group two"); michael@0: michael@0: finish(); michael@0: }, win); michael@0: }); michael@0: }