tor-browser

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

browser_jsterm_autocomplete_helpers.js (1097B)


      1 /* Any copyright is dedicated to the Public Domain.
      2 * http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 // Tests that the autocompletion results contain the names of JSTerm helpers.
      5 // See Bug 686937.
      6 
      7 "use strict";
      8 
      9 const TEST_URI =
     10  "data:text/html;charset=utf8,<!DOCTYPE html><p>test JSTerm Helpers autocomplete";
     11 
     12 add_task(async function () {
     13  await pushPref("devtools.editor.autoclosebrackets", false);
     14  const hud = await openNewTabAndConsole(TEST_URI);
     15  await testInspectAutoCompletion(hud, "i", true);
     16  await testInspectAutoCompletion(hud, "window.", false);
     17  await testInspectAutoCompletion(hud, "dump(i", true);
     18  await testInspectAutoCompletion(hud, "window.dump(i", true);
     19 
     20  info("Close autocomplete popup");
     21  await closeAutocompletePopup(hud);
     22 });
     23 
     24 async function testInspectAutoCompletion(hud, inputValue, expectInspect) {
     25  await setInputValueForAutocompletion(hud, inputValue);
     26  is(
     27    hasPopupLabel(hud.jsterm.autocompletePopup, "inspect"),
     28    expectInspect,
     29    `autocomplete results${
     30      expectInspect ? "" : " does not"
     31    } contain helper 'inspect'`
     32  );
     33 }