browser_jsterm_editor_gutter.js (1385B)
1 /* Any copyright is dedicated to the Public Domain. 2 * http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 // Test that CodeMirror's gutter in console input is displayed when 5 // 'devtools.webconsole.input.editor' is true. 6 // See https://bugzilla.mozilla.org/show_bug.cgi?id=1519315 7 8 "use strict"; 9 10 const TEST_URI = 11 "data:text/html;charset=utf-8,<!DOCTYPE html>Test JsTerm editor line gutters"; 12 13 add_task(async function () { 14 await pushPref("devtools.webconsole.input.editor", true); 15 16 const hud = await openNewTabAndConsole(TEST_URI); 17 18 info("Check that the line numbers gutter is rendered when in editor layout"); 19 ok( 20 getLineNumbersGutterElement(hud), 21 "line numbers gutter is rendered on the input when in editor mode." 22 ); 23 24 info( 25 "Check that the line numbers gutter is hidden we switch to the inline layout" 26 ); 27 await toggleLayout(hud); 28 ok( 29 !getLineNumbersGutterElement(hud), 30 "line numbers gutter is hidden on the input when in inline mode." 31 ); 32 33 info( 34 "Check that the line numbers gutter is rendered again we switch back to editor" 35 ); 36 await toggleLayout(hud); 37 ok( 38 getLineNumbersGutterElement(hud), 39 "line numbers gutter is rendered again on the " + 40 " input when switching back to editor mode." 41 ); 42 }); 43 44 function getLineNumbersGutterElement(hud) { 45 return hud.ui.outputNode.querySelector(".CodeMirror-linenumbers"); 46 }