browser/components/tabview/test/browser_tabview_bug619937.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_bug619937.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,39 @@
     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 +  window.addEventListener("tabviewshown", onTabViewWindowLoaded, false);
    1.11 +  TabView.toggle();
    1.12 +}
    1.13 +
    1.14 +function endGame() {
    1.15 +  window.removeEventListener("tabviewhidden", endGame, false);
    1.16 +  ok(!TabView.isVisible(), "Tab View is hidden");
    1.17 +
    1.18 +  finish();
    1.19 +};
    1.20 +
    1.21 +function onTabViewWindowLoaded() {
    1.22 +  window.removeEventListener("tabviewshown", onTabViewWindowLoaded, false);
    1.23 +  ok(TabView.isVisible(), "Tab View is visible");
    1.24 +
    1.25 +  let contentWindow = document.getElementById("tab-view").contentWindow;
    1.26 +
    1.27 +  // establish initial state
    1.28 +  is(contentWindow.GroupItems.groupItems.length, 1,
    1.29 +      "we start with one group (the default)");
    1.30 +  is(gBrowser.tabs.length, 1, "we start with one tab");
    1.31 +  let originalTab = gBrowser.tabs[0];
    1.32 +
    1.33 +  let bg = contentWindow.document.getElementById("bg");
    1.34 +
    1.35 +  EventUtils.sendMouseEvent({ type: "click" }, bg, contentWindow);
    1.36 +
    1.37 +  is(contentWindow.GroupItems.groupItems.length, 1,
    1.38 +      "we should still only have one group");
    1.39 +
    1.40 +  window.addEventListener("tabviewhidden", endGame, false);
    1.41 +  TabView.toggle();
    1.42 +}

mercurial