browser_dbg-console-eval.js (1082B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */ 4 5 // Tests that clicking the DOM node button in any ObjectInspect 6 // opens the Inspector panel 7 8 "use strict"; 9 10 add_task(async function () { 11 const dbg = await initDebugger("doc-scripts.html", "simple2.js"); 12 13 await selectSource(dbg, "simple2.js", 1); 14 15 clickElement(dbg, "CodeMirrorLines"); 16 await waitForElement(dbg, "CodeMirrorCode"); 17 18 setSelection(dbg, 1, 7); 19 20 rightClickElement(dbg, "CodeMirrorLines"); 21 await waitForContextMenu(dbg); 22 selectContextMenuItem(dbg, "#node-menu-evaluate-in-console"); 23 24 await waitForConsolePanelChange(dbg); 25 await hasConsoleMessage(dbg, "undefined"); 26 }); 27 28 function waitForConsolePanelChange(dbg) { 29 const { toolbox } = dbg; 30 31 return new Promise(resolve => { 32 toolbox.getPanelWhenReady("webconsole").then(() => { 33 ok(toolbox.webconsolePanel, "Console is shown."); 34 resolve(toolbox.webconsolePanel); 35 }); 36 }); 37 }