browser/components/tabview/test/browser_tabview_bug654295.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_bug654295.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,62 @@
     1.4 +/* Any copyright is dedicated to the Public Domain.
     1.5 +   http://creativecommons.org/publicdomain/zero/1.0/ */
     1.6 +
     1.7 +function test() {
     1.8 +  waitForExplicitFinish();
     1.9 +
    1.10 +  const DUMMY_PAGE_URL = "about:blank";
    1.11 +  const DUMMY_PAGE_URL_2 = "http://mochi.test:8888/";
    1.12 +
    1.13 +  // create two groups and each group has one tab item
    1.14 +  let newState = {
    1.15 +    windows: [{
    1.16 +      tabs: [{
    1.17 +        entries: [{ url: DUMMY_PAGE_URL }],
    1.18 +        hidden: true,
    1.19 +        attributes: {},
    1.20 +        extData: {
    1.21 +          "tabview-tab":
    1.22 +            '{"bounds":{"left":21,"top":29,"width":204,"height":153},' +
    1.23 +            '"userSize":null,"url":"' + DUMMY_PAGE_URL + '","groupID":1,' +
    1.24 +            '"imageData":null,"title":null}'
    1.25 +        }
    1.26 +      },{
    1.27 +        entries: [{ url: DUMMY_PAGE_URL_2 }],
    1.28 +        hidden: false,
    1.29 +        attributes: {},
    1.30 +        extData: {
    1.31 +          "tabview-tab":
    1.32 +            '{"bounds":{"left":315,"top":29,"width":111,"height":84},' +
    1.33 +            '"userSize":null,"url":"' + DUMMY_PAGE_URL_2 + '","groupID":2,' +
    1.34 +            '"imageData":null,"title":null}'
    1.35 +        },
    1.36 +      }],
    1.37 +      selected:2,
    1.38 +      _closedTabs: [],
    1.39 +      extData: {
    1.40 +        "tabview-groups": '{"nextID":3,"activeGroupId":2}',
    1.41 +        "tabview-group":
    1.42 +          '{"1":{"bounds":{"left":15,"top":5,"width":280,"height":232},' +
    1.43 +          '"userSize":null,"title":"","id":1},' +
    1.44 +          '"2":{"bounds":{"left":309,"top":5,"width":267,"height":226},' +
    1.45 +          '"userSize":null,"title":"","id":2}}',
    1.46 +        "tabview-ui": '{"pageBounds":{"left":0,"top":0,"width":788,"height":548}}'
    1.47 +      }, sizemode:"normal"
    1.48 +    }]
    1.49 +  };
    1.50 +
    1.51 +  newWindowWithState(newState, function(win) {
    1.52 +    registerCleanupFunction(function () win.close());
    1.53 +
    1.54 +    whenTabViewIsShown(function() {
    1.55 +      let contentWindow = win.TabView.getContentWindow();
    1.56 +
    1.57 +      is(contentWindow.GroupItems.groupItems.length, 2, "There are still two groups");
    1.58 +      is(win.gBrowser.tabs.length, 1, "There is only one tab");
    1.59 +
    1.60 +      finish();
    1.61 +    }, win);
    1.62 +    win.gBrowser.removeTab(win.gBrowser.selectedTab);
    1.63 +  });
    1.64 +}
    1.65 +

mercurial