browser/base/content/test/general/browser_findbarClose.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_findbarClose.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,40 @@
     1.4 +/* Any copyright is dedicated to the Public Domain.
     1.5 +   http://creativecommons.org/publicdomain/zero/1.0/ */
     1.6 +
     1.7 +// Tests find bar auto-close behavior
     1.8 +
     1.9 +let newTab, iframe;
    1.10 +
    1.11 +function test() {
    1.12 +  waitForExplicitFinish();
    1.13 +  newTab = gBrowser.addTab("about:blank");
    1.14 +  newTab.linkedBrowser.addEventListener("DOMContentLoaded",
    1.15 +    prepareTestFindBarStaysOpenOnSubdocumentLocationChange, false);
    1.16 +  newTab.linkedBrowser.contentWindow.location = "http://example.com/browser/" +
    1.17 +    "browser/base/content/test/general/test_bug628179.html";
    1.18 +}
    1.19 +
    1.20 +function prepareTestFindBarStaysOpenOnSubdocumentLocationChange() {
    1.21 +  newTab.linkedBrowser.removeEventListener("DOMContentLoaded",
    1.22 +    prepareTestFindBarStaysOpenOnSubdocumentLocationChange, false);
    1.23 +
    1.24 +  gFindBar.open();
    1.25 +
    1.26 +  iframe = newTab.linkedBrowser.contentDocument.getElementById("iframe");
    1.27 +  iframe.addEventListener("load",
    1.28 +    testFindBarStaysOpenOnSubdocumentLocationChange, false);
    1.29 +  iframe.src = "http://example.org/";
    1.30 +}
    1.31 +
    1.32 +function testFindBarStaysOpenOnSubdocumentLocationChange() {
    1.33 +  iframe.removeEventListener("load",
    1.34 +    testFindBarStaysOpenOnSubdocumentLocationChange, false);
    1.35 +
    1.36 +  ok(!gFindBar.hidden, "the Find bar isn't hidden after the location of a " +
    1.37 +     "subdocument changes");
    1.38 +
    1.39 +  gFindBar.close();
    1.40 +  gBrowser.removeTab(newTab);
    1.41 +  finish();
    1.42 +}
    1.43 +

mercurial