browser/components/tabview/test/browser_tabview_bug593283.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_bug593283.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,75 @@
     1.4 +/* Any copyright is dedicated to the Public Domain.
     1.5 +   http://creativecommons.org/publicdomain/zero/1.0/ */
     1.6 +
     1.7 +const DUMMY_PAGE_URL = "http://example.com/";
     1.8 +
     1.9 +let state = {
    1.10 +  windows: [{
    1.11 +    tabs: [{
    1.12 +      entries: [{ url: DUMMY_PAGE_URL }],
    1.13 +      hidden: false, 
    1.14 +      attributes: {},
    1.15 +      extData: {
    1.16 +        "tabview-tab": '{"url":"' + DUMMY_PAGE_URL + '","groupID":1,"title":null,"active":true}'
    1.17 +      }
    1.18 +    },{
    1.19 +      entries: [{ url: DUMMY_PAGE_URL }],
    1.20 +      hidden: false,
    1.21 +      attributes: {},
    1.22 +      extData: {
    1.23 +        "tabview-tab": '{"url":"' + DUMMY_PAGE_URL + '","groupID":1,"title":null}'
    1.24 +      }
    1.25 +    },{
    1.26 +      entries: [{ url: DUMMY_PAGE_URL }],
    1.27 +      hidden: true,
    1.28 +      attributes: {},
    1.29 +      extData: {
    1.30 +        "tabview-tab": '{"url":"' + DUMMY_PAGE_URL + '","groupID":2,"title":null}'
    1.31 +      },
    1.32 +    },{
    1.33 +      entries: [{ url: DUMMY_PAGE_URL }],
    1.34 +      hidden: true,
    1.35 +      attributes: {},
    1.36 +      extData: {
    1.37 +        "tabview-tab": '{"url":"' + DUMMY_PAGE_URL + '","groupID":2,"title":null,"active":true}'
    1.38 +      },
    1.39 +    }],
    1.40 +    selected:1,
    1.41 +    _closedTabs: [],
    1.42 +    extData: {
    1.43 +      "tabview-groups": '{"nextID":3,"activeGroupId":2,"totalNumber":2}',
    1.44 +      "tabview-group": 
    1.45 +        '{"1":{"bounds":{"left":15,"top":28,"width":546,"height":218},' + 
    1.46 +        '"userSize":{"x":546,"y":218},"title":"","id":1},' +
    1.47 +        '"2":{"bounds":{"left":15,"top":261,"width":546,"height":199},' + 
    1.48 +        '"userSize":{"x":546,"y":199},"title":"","id":2}}',
    1.49 +      "tabview-ui": '{"pageBounds":{"left":0,"top":0,"width":976,"height":663}}'
    1.50 +    }, sizemode:"normal"
    1.51 +  }]
    1.52 +};
    1.53 +
    1.54 +function test() {
    1.55 +  waitForExplicitFinish();
    1.56 +
    1.57 +  newWindowWithState(state, function (win) {
    1.58 +    registerCleanupFunction(function () win.close());
    1.59 +
    1.60 +    showTabView(function() {
    1.61 +      let cw = win.TabView.getContentWindow();
    1.62 +      let groupItems = cw.GroupItems.groupItems;
    1.63 +      let groupOne = groupItems[0];
    1.64 +      let groupTwo = groupItems[1];
    1.65 +
    1.66 +      // check the active tab of each group
    1.67 +      is(groupOne.getActiveTab(), groupOne.getChild(0), "The active tab item of group one is the first one");
    1.68 +      is(groupTwo.getActiveTab(), groupTwo.getChild(1), "The active tab item of group two is the second one");
    1.69 +
    1.70 +      is(cw.UI.getActiveTab(), groupOne.getChild(0), "The hightlighted tab item is the first one in group one");
    1.71 +      // select a group and the second tab should be hightlighted
    1.72 +      cw.UI.setActive(groupTwo);
    1.73 +      is(cw.UI.getActiveTab(), groupTwo.getChild(1), "The hightlighted tab item is the second one in group two");
    1.74 +
    1.75 +      finish();
    1.76 +    }, win);
    1.77 +  });
    1.78 +}

mercurial