tor-browser

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

browser_jsterm_autocomplete_del_key.js (1039B)


      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,<!DOCTYPE html>
      9 <head>
     10  <script>
     11    foo = {
     12      item0: "value0",
     13      item1: "value1",
     14    };
     15  </script>
     16 </head>
     17 <body>Autocomplete popup delete key usage test</body>`;
     18 
     19 add_task(async function () {
     20  const hud = await openNewTabAndConsole(TEST_URI);
     21  const { jsterm } = hud;
     22  info("web console opened");
     23 
     24  const { autocompletePopup: popup } = jsterm;
     25  await setInputValueForAutocompletion(hud, "foo.i");
     26 
     27  ok(popup.isOpen, "popup is open");
     28 
     29  info("press Delete");
     30  const onPopupClose = popup.once("popup-closed");
     31  const onTimeout = wait(1000).then(() => "timeout");
     32  EventUtils.synthesizeKey("KEY_Delete");
     33 
     34  const result = await Promise.race([onPopupClose, onTimeout]);
     35 
     36  is(result, "timeout", "The timeout won the race");
     37  ok(popup.isOpen, "popup is open after hitting delete key");
     38 
     39  await closeAutocompletePopup(hud);
     40 });