browser_jsterm_completion_dollar_zero.js (1291B)
1 /* Any copyright is dedicated to the Public Domain. 2 * http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 // Tests that code completion works properly on $0. 5 6 "use strict"; 7 8 const TEST_URI = `data:text/html;charset=utf-8,<!DOCTYPE html> 9 <head> 10 <title>$0 completion test</title> 11 </head> 12 <body> 13 <div> 14 <h1>$0 completion test</h1> 15 <p>This is some example text</p> 16 </div> 17 </body>`; 18 19 add_task(async function () { 20 const toolbox = await openNewTabAndToolbox(TEST_URI, "inspector"); 21 await selectNodeWithPicker(toolbox, "h1"); 22 23 info("Picker mode stopped, <h1> selected, now switching to the console"); 24 const hud = await openConsole(); 25 const { jsterm } = hud; 26 27 await clearOutput(hud); 28 29 const { autocompletePopup } = jsterm; 30 31 await setInputValueForAutocompletion(hud, "$0."); 32 ok( 33 hasPopupLabel(autocompletePopup, "attributes"), 34 "autocomplete popup has expected items" 35 ); 36 is(autocompletePopup.isOpen, true, "autocomplete popup is open"); 37 38 await setInputValueForAutocompletion(hud, "$0.attributes."); 39 is(autocompletePopup.isOpen, true, "autocomplete popup is open"); 40 ok( 41 hasPopupLabel(autocompletePopup, "getNamedItem"), 42 "autocomplete popup has expected items" 43 ); 44 45 info("Close autocomplete popup"); 46 await closeAutocompletePopup(hud); 47 });