tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

browser_jsonview_initial_focus.js (1001B)


      1 /* Any copyright is dedicated to the Public Domain.
      2 * http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 const VALID_JSON_URL = URL_ROOT + "valid_json.json";
      7 
      8 add_task(async function () {
      9  info("Test focus JSON view started");
     10  await addJsonViewTab(VALID_JSON_URL);
     11 
     12  await SpecialPowers.spawn(gBrowser.selectedBrowser, [], async () => {
     13    const scroller = content.document.getElementById("json-scrolling-panel");
     14    ok(scroller, "Found the scrollable area");
     15    is(
     16      content.document.activeElement,
     17      scroller,
     18      "Scrollable area initially focused"
     19    );
     20  });
     21  await reloadBrowser();
     22  await SpecialPowers.spawn(gBrowser.selectedBrowser, [], async () => {
     23    const scroller = await ContentTaskUtils.waitForCondition(
     24      () => content.document.getElementById("json-scrolling-panel"),
     25      "Wait for the panel to be loaded"
     26    );
     27    is(
     28      content.document.activeElement,
     29      scroller,
     30      "Scrollable area focused after reload"
     31    );
     32  });
     33 });