browser/components/tabview/test/browser_tabview_bug643392.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_bug643392.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,54 @@
     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:mozilla" }],
    1.11 +      hidden: true,
    1.12 +      extData: {"tabview-tab": '{"url":"about:mozilla","groupID":1,"bounds":{"left":20,"top":20,"width":20,"height":20}}'}
    1.13 +    },{
    1.14 +      entries: [{ url: "about:mozilla" }],
    1.15 +      hidden: false,
    1.16 +      extData: {"tabview-tab": '{"url":"about:mozilla","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}',
    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 +    is(win.gBrowser.tabs.length, 2, "two tabs");
    1.35 +
    1.36 +    let opts = {animate: true, byMouse: true};
    1.37 +    win.gBrowser.removeTab(win.gBrowser.visibleTabs[0], opts);
    1.38 +
    1.39 +    let checkTabCount = function () {
    1.40 +      if (win.gBrowser.tabs.length > 1) {
    1.41 +        executeSoon(checkTabCount);
    1.42 +        return;
    1.43 +      }
    1.44 +
    1.45 +      is(win.gBrowser.tabs.length, 1, "one tab");
    1.46 +
    1.47 +      showTabView(function () {
    1.48 +        let cw = win.TabView.getContentWindow();
    1.49 +        is(cw.TabItems.items.length, 1, "one tabItem");
    1.50 +
    1.51 +        waitForFocus(finish);
    1.52 +      }, win);
    1.53 +    };
    1.54 +
    1.55 +    checkTabCount();
    1.56 +  });
    1.57 +}

mercurial