tor-browser

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

browser_editor_addons.js (923B)


      1 /* Any copyright is dedicated to the Public Domain.
      2   http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 async function test() {
      7  waitForExplicitFinish();
      8 
      9  const { ed, win } = await setup();
     10  const doc = win.document.querySelector("iframe").contentWindow.document;
     11 
     12  // trailingspace.js
     13  ed.setText("Hello   ");
     14  ed.setOption("showTrailingSpace", false);
     15  ok(!doc.querySelector(".cm-trailingspace"));
     16  ed.setOption("showTrailingSpace", true);
     17  ok(doc.querySelector(".cm-trailingspace"));
     18 
     19  // foldcode.js and foldgutter.js
     20  ed.setMode(Editor.modes.javascript);
     21  ed.setText("function main() {\nreturn 'Hello, World!';\n}");
     22  executeSoon(() => testFold(doc, ed, win));
     23 }
     24 
     25 function testFold(doc, ed, win) {
     26  // Wait until folding arrow is there.
     27  if (!doc.querySelector(".CodeMirror-foldgutter-open")) {
     28    executeSoon(() => testFold(doc, ed, win));
     29    return;
     30  }
     31 
     32  teardown(ed, win);
     33 }