1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/components/tabview/test/browser_tabview_bug712203.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,67 @@ 1.4 +/* Any copyright is dedicated to the Public Domain. 1.5 + http://creativecommons.org/publicdomain/zero/1.0/ */ 1.6 + 1.7 + 1.8 +function test() { 1.9 + waitForExplicitFinish(); 1.10 + 1.11 + // create two groups and each group has one tab item 1.12 + let newState = { 1.13 + windows: [{ 1.14 + tabs: [{ 1.15 + entries: [{ url: "about:mozilla" }], 1.16 + hidden: true, 1.17 + attributes: {}, 1.18 + extData: { 1.19 + "tabview-tab": 1.20 + '{"bounds":{"left":21,"top":29,"width":204,"height":153},' + 1.21 + '"userSize":null,"url":"about:mozilla","groupID":1,' + 1.22 + '"imageData":null,"title":null}' 1.23 + } 1.24 + },{ 1.25 + entries: [{ url: "about:blank" }], 1.26 + hidden: false, 1.27 + attributes: {}, 1.28 + extData: { 1.29 + "tabview-tab": 1.30 + '{"bounds":{"left":315,"top":29,"width":111,"height":84},' + 1.31 + '"userSize":null,"url":"about:blank","groupID":2,' + 1.32 + '"imageData":null,"title":null}' 1.33 + }, 1.34 + }], 1.35 + selected:2, 1.36 + _closedTabs: [], 1.37 + extData: { 1.38 + "tabview-groups": '{"nextID":3,"activeGroupId":2}', 1.39 + "tabview-group": 1.40 + '{"1":{"bounds":{"left":15,"top":5,"width":280,"height":232},' + 1.41 + '"userSize":null,"title":"","id":1},' + 1.42 + '"2":{"bounds":{"left":309,"top":5,"width":267,"height":226},' + 1.43 + '"userSize":null,"title":"","id":2}}', 1.44 + "tabview-ui": '{"pageBounds":{"left":0,"top":0,"width":788,"height":548}}' 1.45 + }, sizemode:"normal" 1.46 + }] 1.47 + }; 1.48 + 1.49 + newWindowWithState(newState, function(win) { 1.50 + registerCleanupFunction(function () win.close()); 1.51 + 1.52 + let selectedTab = win.gBrowser.selectedTab; 1.53 + 1.54 + win.addEventListener("tabviewframeinitialized", function onInit() { 1.55 + win.removeEventListener("tabviewframeinitialized", onInit, false); 1.56 + // ensure the TabView.contentWindow is set. 1.57 + executeSoon(function() { 1.58 + let cw = win.TabView.getContentWindow(); 1.59 + 1.60 + is(cw.GroupItems.groupItems.length, 2, "There are two groups"); 1.61 + is(cw.GroupItems.getActiveGroupItem().id, 1, "The active group item is 1"); 1.62 + isnot(selectedTab, win.gBrowser.selectedTab, "The selected tab is different"); 1.63 + 1.64 + finish(); 1.65 + }); 1.66 + }, false); 1.67 + 1.68 + goToNextGroup(win); 1.69 + }); 1.70 +}