browser/components/tabview/test/browser_tabview_bug656913.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_bug656913.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,45 @@
     1.4 +/* Any copyright is dedicated to the Public Domain.
     1.5 +   http://creativecommons.org/publicdomain/zero/1.0/ */
     1.6 +
     1.7 +// ----------
     1.8 +function test() {
     1.9 +  waitForExplicitFinish();
    1.10 +
    1.11 +  let urlBase = "http://mochi.test:8888/browser/browser/components/tabview/test/";
    1.12 +  let newTab = gBrowser.addTab(urlBase + "search1.html");
    1.13 +
    1.14 +  registerCleanupFunction(function() {
    1.15 +    if (gBrowser.tabs[1])
    1.16 +      gBrowser.removeTab(gBrowser.tabs[1]);
    1.17 +    TabView.hide();
    1.18 +  });
    1.19 +
    1.20 +  afterAllTabsLoaded(function() {
    1.21 +    showTabView(function() {
    1.22 +      hideTabView(function() {
    1.23 +        newTab.linkedBrowser.loadURI(urlBase + "dummy_page.html");
    1.24 +
    1.25 +        newWindowWithTabView(function(win) {
    1.26 +          registerCleanupFunction(function() win.close());
    1.27 +
    1.28 +          let contentWindow = win.TabView.getContentWindow();
    1.29 +
    1.30 +          EventUtils.synthesizeKey("d", { }, contentWindow);
    1.31 +          EventUtils.synthesizeKey("u", { }, contentWindow);
    1.32 +          EventUtils.synthesizeKey("m", { }, contentWindow);
    1.33 +
    1.34 +          let resultsElement = contentWindow.document.getElementById("results");
    1.35 +          let childElements = resultsElement.childNodes;
    1.36 +
    1.37 +          is(childElements.length, 1, "There is one result element");
    1.38 +          is(childElements[0].childNodes[1].textContent, 
    1.39 +             "This is a dummy test page", 
    1.40 +             "The label matches the title of dummy page");
    1.41 +
    1.42 +          finish();
    1.43 +        });
    1.44 +      });
    1.45 +    });
    1.46 +  });
    1.47 +}
    1.48 +

mercurial