Bug 1470922 - Fix tests failing with the new Jsterm; r=bgrins. draft
authorNicolas Chevobbe <nchevobbe@mozilla.com>
Wed, 25 Jul 2018 10:58:01 +0200
changeset 823802 bf5073d9372f6458f9085c5aaa9e8c8e3f8bcf5a
parent 823801 7c4ca7af4514e33e49e841675c3bdfb6979cf97f
push id117787
push userbmo:nchevobbe@mozilla.com
push dateSat, 28 Jul 2018 15:39:52 +0000
reviewersbgrins
bugs1470922
milestone63.0a1
Bug 1470922 - Fix tests failing with the new Jsterm; r=bgrins. MozReview-Commit-ID: EaOSFmWa1tZ
devtools/client/debugger/test/mochitest/browser_dbg_split-console-keypress.js
devtools/client/framework/test/browser_toolbox_split_console.js
devtools/client/inspector/test/browser_inspector_menu-04-use-in-console.js
devtools/client/webconsole/test/mochitest/browser_webconsole_split.js
--- a/devtools/client/debugger/test/mochitest/browser_dbg_split-console-keypress.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg_split-console-keypress.js
@@ -59,17 +59,18 @@ function test() {
     executeSoon(() => generateMouseClickInTab(gTab,
       "content.document.getElementById('start')"));
     yield waitForPause(gThreadClient);
 
     // Focus the console and add event listener to track whether it loses focus
     // (Must happen after generateMouseClickInTab() call)
     let consoleLostFocus = false;
     jsterm.focus();
-    jsterm.inputNode.addEventListener("blur", () => {consoleLostFocus = true;});
+    const node = jsterm.inputNode || jsterm.node;
+    node.addEventListener("blur", () => {consoleLostFocus = true;});
 
     is(gThreadClient.paused, true,
       "Should be paused at debugger statement.");
     // As long as we have test work to do..
     for (let i = 0, thisTest; thisTest = stepTests[i]; i++) {
       // First we send another key event if required by the test
       while (thisTest.keyRepeat > 0) {
         thisTest.keyRepeat --;
--- a/devtools/client/framework/test/browser_toolbox_split_console.js
+++ b/devtools/client/framework/test/browser_toolbox_split_console.js
@@ -47,37 +47,39 @@ function testUseKeyWithSplitConsole() {
   let commandCalled = false;
 
   info("useKeyWithSplitConsole on debugger while debugger is focused");
   gToolbox.useKeyWithSplitConsole("F3", () => {
     commandCalled = true;
   }, "jsdebugger");
 
   info("synthesizeKey with the console focused");
-  const consoleInput = gToolbox.getPanel("webconsole").hud.jsterm.inputNode;
-  consoleInput.focus();
+  focusConsoleInput();
   synthesizeKeyShortcut("F3", panelWin);
 
   ok(commandCalled, "Shortcut key should trigger the command");
 }
 
 // A key bound to a *different* tool should not trigger it's command
 function testUseKeyWithSplitConsoleWrongTool() {
   let commandCalled = false;
 
   info("useKeyWithSplitConsole on inspector while debugger is focused");
   gToolbox.useKeyWithSplitConsole("F4", () => {
     commandCalled = true;
   }, "inspector");
 
   info("synthesizeKey with the console focused");
-  const consoleInput = gToolbox.getPanel("webconsole").hud.jsterm.inputNode;
-  consoleInput.focus();
+  focusConsoleInput();
   synthesizeKeyShortcut("F4", panelWin);
 
   ok(!commandCalled, "Shortcut key shouldn't trigger the command");
 }
 
 async function cleanup() {
   await gToolbox.destroy();
   gBrowser.removeCurrentTab();
   gToolbox = panelWin = null;
 }
+
+function focusConsoleInput() {
+  gToolbox.getPanel("webconsole").hud.jsterm.focus();
+}
--- a/devtools/client/inspector/test/browser_inspector_menu-04-use-in-console.js
+++ b/devtools/client/inspector/test/browser_inspector_menu-04-use-in-console.js
@@ -23,28 +23,27 @@ add_task(async function() {
     const menuItem = allMenuItems.find(i => i.id === "node-menu-useinconsole");
     menuItem.click();
 
     await inspector.once("console-var-ready");
 
     const hud = toolbox.getPanel("webconsole").hud;
     const jsterm = hud.jsterm;
 
-    const jstermInput = jsterm.hud.document.querySelector(".jsterm-input-node");
-    is(jstermInput.value, "temp0", "first console variable is named temp0");
+    is(jsterm.getInputValue(), "temp0", "first console variable is named temp0");
 
     let result = await jsterm.execute();
     isnot(result.textContent.indexOf('<p id="console-var">'), -1,
           "variable temp0 references correct node");
 
     await selectNode("#console-var-multi", inspector);
     menuItem.click();
     await inspector.once("console-var-ready");
 
-    is(jstermInput.value, "temp1", "second console variable is named temp1");
+    is(jsterm.getInputValue(), "temp1", "second console variable is named temp1");
 
     result = await jsterm.execute();
     isnot(result.textContent.indexOf('<p id="console-var-multi">'), -1,
           "variable temp1 references correct node");
 
     hud.ui.consoleOutput.dispatchClearHistory();
   }
 });
--- a/devtools/client/webconsole/test/mochitest/browser_webconsole_split.js
+++ b/devtools/client/webconsole/test/mochitest/browser_webconsole_split.js
@@ -20,17 +20,16 @@ add_task(async function() {
   await performTests();
   // And then run it with the CodeMirror-powered one.
   await pushPref("devtools.webconsole.jsterm.codeMirror", true);
   await performTests();
 });
 
 async function performTests() {
   let toolbox;
-  await pushPref("devtools.webconsole.jsterm.codeMirror", true);
   await addTab(TEST_URI);
   await testConsoleLoadOnDifferentPanel();
   await testKeyboardShortcuts();
   await checkAllTools();
 
   info("Testing host types");
   checkHostType(Toolbox.HostType.BOTTOM);
   await checkToolboxUI();