browser/components/tabview/test/browser_tabview_bug697390.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/browser/components/tabview/test/browser_tabview_bug697390.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,51 @@
     1.4 +/* Any copyright is dedicated to the Public Domain.
     1.5 +   http://creativecommons.org/publicdomain/zero/1.0/ */
     1.6 +
     1.7 +let state = {
     1.8 +  windows: [{
     1.9 +    tabs: [{
    1.10 +      entries: [{ url: "about:robots" }],
    1.11 +      hidden: true,
    1.12 +      extData: {"tabview-tab": '{"url":"about:robots","groupID":1,"bounds":{"left":120,"top":20,"width":20,"height":20}}'}
    1.13 +    },{
    1.14 +      entries: [{ url: "about:robots" }],
    1.15 +      hidden: false,
    1.16 +      extData: {"tabview-tab": '{"url":"about:robots","groupID":2,"bounds":{"left":20,"top":20,"width":20,"height":20}}'},
    1.17 +    }],
    1.18 +    selected: 2,
    1.19 +    extData: {
    1.20 +      "tabview-groups": '{"nextID":3,"activeGroupId":2, "totalNumber":2}',
    1.21 +      "tabview-group":
    1.22 +        '{"1":{"bounds":{"left":15,"top":5,"width":280,"height":232},"id":1},' +
    1.23 +        '"2":{"bounds":{"left":309,"top":5,"width":267,"height":226},"id":2}}'
    1.24 +    }
    1.25 +  }]
    1.26 +};
    1.27 +
    1.28 +function test() {
    1.29 +  waitForExplicitFinish();
    1.30 +
    1.31 +  newWindowWithState(state, function(win) {
    1.32 +    registerCleanupFunction(function() win.close());
    1.33 +
    1.34 +    win.gBrowser.addTab();
    1.35 +
    1.36 +    ok(win.gBrowser.tabs[0].hidden, "The first tab is hidden");
    1.37 +    win.gBrowser.selectedTab = win.gBrowser.tabs[0];
    1.38 +
    1.39 +    function onTabViewFrameInitialized() {
    1.40 +      win.removeEventListener(
    1.41 +        "tabviewframeinitialized", onTabViewFrameInitialized, false);
    1.42 +
    1.43 +      let cw = win.TabView.getContentWindow();
    1.44 +      is(cw.GroupItems.groupItem(1).getChild(0).tab, win.gBrowser.selectedTab, "The tab in group one matches the selected tab");
    1.45 +      is(cw.GroupItems.groupItem(1).getChildren().length, 1, "The group one has only one tab item");
    1.46 +      is(cw.GroupItems.groupItem(2).getChildren().length, 2, "The group one has only two tab item")
    1.47 +
    1.48 +      finish();
    1.49 +    }
    1.50 +    win.addEventListener(
    1.51 +      "tabviewframeinitialized", onTabViewFrameInitialized, false);
    1.52 +  });
    1.53 +}
    1.54 +

mercurial