browser_jsterm_autocomplete_expression_variables.js (1312B)
1 /* Any copyright is dedicated to the Public Domain. 2 * http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 // Tests that variable created in the expression are displayed in the autocomplete. 5 6 "use strict"; 7 8 const TEST_URI = `data:text/html;charset=utf8,<!DOCTYPE html>Test autocompletion for expression variables<script> 9 var testGlobal; 10 </script>`; 11 12 add_task(async function () { 13 const hud = await openNewTabAndConsole(TEST_URI); 14 const { jsterm } = hud; 15 const { autocompletePopup } = jsterm; 16 17 await setInputValueForAutocompletion( 18 hud, 19 ` 20 var testVar; 21 let testLet; 22 const testConst; 23 class testClass { 24 #secret 25 #getSecret() {} 26 } 27 function testFunc(testParam1, testParam2, ...testParamRest) { 28 var [testParamRestFirst] = testParamRest; 29 let {testDeconstruct1,testDeconstruct2, ...testDeconstructRest} = testParam1; 30 test` 31 ); 32 33 ok( 34 hasExactPopupLabels(autocompletePopup, [ 35 "testClass", 36 "testConst", 37 "testDeconstruct1", 38 "testDeconstruct2", 39 "testDeconstructRest", 40 "testFunc", 41 "testGlobal", 42 "testLet", 43 "testParam1", 44 "testParam2", 45 "testParamRest", 46 "testParamRestFirst", 47 "testVar", 48 ]), 49 "Autocomplete popup displays both global and local variables" 50 ); 51 });