michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: let state = { michael@0: windows: [{ michael@0: tabs: [{ michael@0: entries: [{ url: "about:robots" }], michael@0: hidden: true, michael@0: extData: {"tabview-tab": '{"url":"about:robots","groupID":1,"bounds":{"left":120,"top":20,"width":20,"height":20}}'} michael@0: },{ michael@0: entries: [{ url: "about:robots" }], michael@0: hidden: false, michael@0: extData: {"tabview-tab": '{"url":"about:robots","groupID":2,"bounds":{"left":20,"top":20,"width":20,"height":20}}'}, michael@0: }], michael@0: selected: 2, michael@0: extData: { michael@0: "tabview-groups": '{"nextID":3,"activeGroupId":2, "totalNumber":2}', michael@0: "tabview-group": michael@0: '{"1":{"bounds":{"left":15,"top":5,"width":280,"height":232},"id":1},' + michael@0: '"2":{"bounds":{"left":309,"top":5,"width":267,"height":226},"id":2}}' michael@0: } 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: win.gBrowser.addTab(); michael@0: michael@0: ok(win.gBrowser.tabs[0].hidden, "The first tab is hidden"); michael@0: win.gBrowser.selectedTab = win.gBrowser.tabs[0]; michael@0: michael@0: function onTabViewFrameInitialized() { michael@0: win.removeEventListener( michael@0: "tabviewframeinitialized", onTabViewFrameInitialized, false); michael@0: michael@0: let cw = win.TabView.getContentWindow(); michael@0: is(cw.GroupItems.groupItem(1).getChild(0).tab, win.gBrowser.selectedTab, "The tab in group one matches the selected tab"); michael@0: is(cw.GroupItems.groupItem(1).getChildren().length, 1, "The group one has only one tab item"); michael@0: is(cw.GroupItems.groupItem(2).getChildren().length, 2, "The group one has only two tab item") michael@0: michael@0: finish(); michael@0: } michael@0: win.addEventListener( michael@0: "tabviewframeinitialized", onTabViewFrameInitialized, false); michael@0: }); michael@0: } michael@0: