Bug 1404371 - migrate and rename browser_webconsole_input_expansion.js;r=Honza draft
authorJulian Descottes <jdescottes@mozilla.com>
Wed, 17 Jan 2018 13:34:01 +0100
changeset 721686 375242c390603892d79d85c5dd6d425b615e4e97
parent 721495 4e429d313fd2e0f9202271ee8f3fb798817ec3e7
child 746420 328928889ec20a007b2934d84f2dcec61094bd04
push id95930
push userjdescottes@mozilla.com
push dateWed, 17 Jan 2018 19:04:35 +0000
reviewersHonza
bugs1404371
milestone59.0a1
Bug 1404371 - migrate and rename browser_webconsole_input_expansion.js;r=Honza MozReview-Commit-ID: JAS13KdCDoP
devtools/client/webconsole/new-console-output/test/mochitest/browser.ini
devtools/client/webconsole/new-console-output/test/mochitest/browser_jsterm_input_expansion.js
devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_input_expansion.js
--- a/devtools/client/webconsole/new-console-output/test/mochitest/browser.ini
+++ b/devtools/client/webconsole/new-console-output/test/mochitest/browser.ini
@@ -215,16 +215,17 @@ skip-if = true #	Bug 1403188
 [browser_jsterm_completion.js]
 [browser_jsterm_copy_command.js]
 [browser_jsterm_ctrl_key_nav.js]
 skip-if = os != 'mac' # The tested ctrl+key shortcuts are OSX only
 [browser_jsterm_dollar.js]
 [browser_jsterm_history.js]
 [browser_jsterm_history_persist.js]
 [browser_jsterm_history_nav.js]
+[browser_jsterm_input_expansion.js]
 [browser_jsterm_inspect.js]
 [browser_jsterm_multiline.js]
 [browser_jsterm_no_autocompletion_on_defined_variables.js]
 [browser_jsterm_no_input_and_tab_key_pressed.js]
 [browser_jsterm_no_input_change_and_tab_key_pressed.js]
 [browser_jsterm_popup_close_on_tab_switch.js]
 [browser_jsterm_popup.js]
 [browser_jsterm_selfxss.js]
@@ -282,18 +283,16 @@ skip-if = true #	Bug 1404382
 [browser_webconsole_hpkp_invalid-headers.js]
 [browser_webconsole_hsts_invalid-headers.js]
 [browser_webconsole_iframe_wrong_hud.js]
 skip-if = true #	Bug 1404378
 [browser_webconsole_ineffective_iframe_sandbox_warning.js]
 skip-if = true #	Bug 1404883
 # old console skip-if = (os == 'win' && bits == 64) # Bug 1390001
 [browser_webconsole_init.js]
-[browser_webconsole_input_expansion.js]
-skip-if = true #	Bug 1404371
 [browser_webconsole_input_field_focus_on_panel_select.js]
 skip-if = true #	Bug 1405343
 [browser_webconsole_input_focus.js]
 [browser_webconsole_insecure_passwords_about_blank_web_console_warning.js]
 skip-if = true #	Bug 1404884
 [browser_webconsole_insecure_passwords_web_console_warning.js]
 skip-if = true #	Bug 1404888
 # old console skip-if = true # Bug 1110500 - mouse event failure in test
rename from devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_input_expansion.js
rename to devtools/client/webconsole/new-console-output/test/mochitest/browser_jsterm_input_expansion.js
--- a/devtools/client/webconsole/new-console-output/test/mochitest/browser_webconsole_input_expansion.js
+++ b/devtools/client/webconsole/new-console-output/test/mochitest/browser_jsterm_input_expansion.js
@@ -1,46 +1,38 @@
 /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
 /* vim: set ft=javascript ts=2 et sw=2 tw=80: */
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 "use strict";
 
-// See Bug 588967.
+// Check that the jsterm input supports multiline values. See Bug 588967.
 
-const TEST_URI = "http://example.com/browser/devtools/client/webconsole/" +
-                 "test/test-console.html";
+const TEST_URI = "data:text/html;charset=utf-8,Test for jsterm multine input";
 
-add_task(function* () {
-  yield loadTab(TEST_URI);
-
-  let hud = yield openConsole();
+add_task(async function () {
+  let hud = await openNewTabAndConsole(TEST_URI);
 
-  testInputExpansion(hud);
-});
-
-function testInputExpansion(hud) {
   let input = hud.jsterm.inputNode;
 
+  info("Focus the jsterm input");
   input.focus();
 
-  is(input.getAttribute("multiline"), "true", "multiline is enabled");
-
   let ordinaryHeight = input.clientHeight;
 
-  // Tests if the inputNode expands.
+  // Set a multiline value
   input.value = "hello\nworld\n";
+
+  // Set the caret at the end of input
   let length = input.value.length;
   input.selectionEnd = length;
   input.selectionStart = length;
-  // Performs an "d". This will trigger/test for the input event that should
-  // change the height of the inputNode.
+
+  info("Type 'd' in jsterm to trigger height change for the input");
   EventUtils.synthesizeKey("d", {});
   ok(input.clientHeight > ordinaryHeight, "the input expanded");
 
-  // Test if the inputNode shrinks again.
+  info("Erase the value and test if the inputNode shrinks again");
   input.value = "";
   EventUtils.synthesizeKey("d", {});
   is(input.clientHeight, ordinaryHeight, "the input's height is normal again");
-
-  input = length = null;
-}
+});