tor-browser

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

browser_styleeditor_navigate.js (978B)


      1 /* Any copyright is dedicated to the Public Domain.
      2   http://creativecommons.org/publicdomain/zero/1.0/ */
      3 "use strict";
      4 
      5 // Test that selected sheet and cursor position is reset during navigation.
      6 
      7 const TESTCASE_URI = TEST_BASE_HTTPS + "simple.html";
      8 const NEW_URI = TEST_BASE_HTTPS + "media.html";
      9 
     10 const LINE_NO = 5;
     11 const COL_NO = 3;
     12 
     13 add_task(async function () {
     14  const { ui } = await openStyleEditorForURL(TESTCASE_URI);
     15 
     16  is(ui.editors.length, 2, "Two sheets present after load.");
     17 
     18  info("Selecting the second editor");
     19  await ui.selectStyleSheet(ui.editors[1].styleSheet, LINE_NO, COL_NO);
     20 
     21  await navigateToAndWaitForStyleSheets(NEW_URI, ui, 2);
     22 
     23  info("Waiting for source editor to be ready.");
     24  await ui.editors[0].getSourceEditor();
     25 
     26  is(ui.selectedEditor, ui.editors[0], "first editor is selected");
     27 
     28  const { line, ch } = ui.selectedEditor.sourceEditor.getCursor();
     29  is(line, 0, "first line is selected");
     30  is(ch, 0, "first column is selected");
     31 });