browser/base/content/test/general/browser_bug422590.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/browser/base/content/test/general/browser_bug422590.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,50 @@
     1.4 +function test() {
     1.5 +  waitForExplicitFinish();
     1.6 +  // test the main (normal) browser window
     1.7 +  testCustomize(window, testChromeless);
     1.8 +}
     1.9 +
    1.10 +function testChromeless() {
    1.11 +  // test a chromeless window
    1.12 +  var newWin = openDialog(getBrowserURL(), "_blank",
    1.13 +                          "chrome,dialog=no,location=yes,toolbar=no", "about:blank");
    1.14 +  ok(newWin, "got new window");
    1.15 +
    1.16 +  whenDelayedStartupFinished(newWin, function () {
    1.17 +    // Check that the search bar is hidden
    1.18 +    var searchBar = newWin.BrowserSearch.searchBar;
    1.19 +    ok(searchBar, "got search bar");
    1.20 +
    1.21 +    var searchBarBO = searchBar.boxObject;
    1.22 +    is(searchBarBO.width, 0, "search bar hidden");
    1.23 +    is(searchBarBO.height, 0, "search bar hidden");
    1.24 +
    1.25 +    testCustomize(newWin, function () {
    1.26 +      newWin.close();
    1.27 +      finish();
    1.28 +    });
    1.29 +  });
    1.30 +}
    1.31 +
    1.32 +function testCustomize(aWindow, aCallback) {
    1.33 +  var fileMenu = aWindow.document.getElementById("file-menu");
    1.34 +  ok(fileMenu, "got file menu");
    1.35 +  is(fileMenu.disabled, false, "file menu initially enabled");
    1.36 +
    1.37 +  openToolbarCustomizationUI(function () {
    1.38 +    // Can't use the property, since the binding may have since been removed
    1.39 +    // if the element is hidden (see bug 422590)
    1.40 +    is(fileMenu.getAttribute("disabled"), "true",
    1.41 +       "file menu is disabled during toolbar customization");
    1.42 +
    1.43 +    closeToolbarCustomizationUI(onClose, aWindow);
    1.44 +  }, aWindow);
    1.45 +
    1.46 +  function onClose() {
    1.47 +    is(fileMenu.getAttribute("disabled"), "false",
    1.48 +       "file menu is enabled after toolbar customization");
    1.49 +
    1.50 +    if (aCallback)
    1.51 +      aCallback();
    1.52 +  }
    1.53 +}

mercurial