tor-browser

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

browser_jsterm_autocomplete_array_no_index.js (887B)


      1 /* Any copyright is dedicated to the Public Domain.
      2 * http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 // See Bug 585991.
      7 
      8 const TEST_URI = `data:text/html;charset=utf-8,
      9 <!DOCTYPE html>
     10 <head>
     11  <script>
     12    window.foo = [1,2,3];
     13  </script>
     14 </head>
     15 <body>bug 585991 - Autocomplete popup on array</body>`;
     16 
     17 add_task(async function () {
     18  const hud = await openNewTabAndConsole(TEST_URI);
     19  const { autocompletePopup: popup } = hud.jsterm;
     20 
     21  const onPopUpOpen = popup.once("popup-opened");
     22 
     23  info("wait for popup to show");
     24  setInputValue(hud, "foo");
     25  EventUtils.sendString(".");
     26 
     27  await onPopUpOpen;
     28 
     29  ok(
     30    !hasPopupLabel(popup, "0"),
     31    "Completing on an array doesn't show numbers."
     32  );
     33 
     34  info("press Escape to close the popup");
     35  const onPopupClose = popup.once("popup-closed");
     36  EventUtils.synthesizeKey("KEY_Escape");
     37 
     38  await onPopupClose;
     39 });