browser_jsterm_autocomplete_await.js (1126B)
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>Autocomplete await expression`; 9 10 add_task(async function () { 11 const hud = await openNewTabAndConsole(TEST_URI); 12 const { jsterm } = hud; 13 const { autocompletePopup } = jsterm; 14 15 info("Check that the await keyword is in the autocomplete"); 16 await setInputValueForAutocompletion(hud, "aw"); 17 checkInputCompletionValue(hud, "ait", "completeNode has expected value"); 18 19 EventUtils.synthesizeKey("KEY_Tab"); 20 is(getInputValue(hud), "await", "'await' tab completion"); 21 22 const updated = jsterm.once("autocomplete-updated"); 23 EventUtils.sendString(" "); 24 await updated; 25 26 info("Check that the autocomplete popup is displayed"); 27 const onPopUpOpen = autocompletePopup.once("popup-opened"); 28 EventUtils.sendString("P"); 29 await onPopUpOpen; 30 31 ok(autocompletePopup.isOpen, "popup is open"); 32 ok( 33 autocompletePopup.items.some(item => item.label === "Promise"), 34 "popup has expected `Promise` item" 35 ); 36 });