tor-browser

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

browser_dbg-breakpoints-scroll-to-log.js (1883B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2 * License, v. 2.0. If a copy of the MPL was not distributed with this
      3 * file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
      4 
      5 // Confirms the editor scrolls to the correct line when a log point is set or edited from
      6 // the breakpoints context menu.
      7 
      8 "use strict";
      9 
     10 add_task(async function () {
     11  const dbg = await initDebugger("doc-scripts.html");
     12  await selectSource(dbg, "long.js");
     13  await waitForSelectedSource(dbg, "long.js");
     14 
     15  await addBreakpoint(dbg, "long.js", 66);
     16  await waitForBreakpoint(dbg, "long.js", 66);
     17 
     18  info("scroll editor to the top");
     19  await scrollEditorIntoView(dbg, 1, 0);
     20 
     21  ok(isScrolledPositionVisible(dbg, 1, 0), "editor is scrolled to the top.");
     22 
     23  info("open breakpointContextMenu and select add log");
     24  await openBreakpointContextMenu(dbg);
     25 
     26  selectContextMenuItem(
     27    dbg,
     28    `${selectors.addLogItem},${selectors.editLogItem}`
     29  );
     30 
     31  info("set the log value");
     32  await typeInPanel(dbg, "this.todos");
     33  await waitForDispatch(dbg.store, "SET_BREAKPOINT");
     34 
     35  ok(
     36    isScrolledPositionVisible(dbg, 67),
     37    "editor is scrolled to the log input line."
     38  );
     39 
     40  info("scroll editor to the top");
     41  await scrollEditorIntoView(dbg, 1, 0);
     42 
     43  ok(isScrolledPositionVisible(dbg, 1, 0), "editor is scrolled to the top.");
     44 
     45  info("open breakpointContextMenu and select edit log");
     46  await openBreakpointContextMenu(dbg);
     47 
     48  selectContextMenuItem(
     49    dbg,
     50    `${selectors.addLogItem},${selectors.editLogItem}`
     51  );
     52 
     53  info("set the log value");
     54  await typeInPanel(dbg, ".id");
     55  await waitForDispatch(dbg.store, "SET_BREAKPOINT");
     56 
     57  ok(
     58    isScrolledPositionVisible(dbg, 67),
     59    "editor is scrolled to the log input line."
     60  );
     61 });
     62 
     63 async function openBreakpointContextMenu(dbg) {
     64  rightClickElement(dbg, "breakpointItem", 2);
     65  await waitForContextMenu(dbg);
     66 }