Bug 1479521 - Only run browser_jsterm_accessibility.js with old jsterm; r=Honza.
authorNicolas Chevobbe <nchevobbe@mozilla.com>
Mon, 13 Aug 2018 10:07:00 +0000
changeset 486297 a28c7f13b6a6f5d1471cb98de79a59316cd25475
parent 486296 6011582e3f69efcbba042b286523d2016c174c18
child 486298 e906e53dd6ba1b75a2b6ab6913776cb931810a70
push id9719
push userffxbld-merge
push dateFri, 24 Aug 2018 17:49:46 +0000
treeherdermozilla-beta@719ec98fba77 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersHonza
bugs1479521
milestone63.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1479521 - Only run browser_jsterm_accessibility.js with old jsterm; r=Honza. Depends on D2826 Differential Revision: https://phabricator.services.mozilla.com/D2827
devtools/client/webconsole/test/mochitest/browser_jsterm_accessibility.js
--- a/devtools/client/webconsole/test/mochitest/browser_jsterm_accessibility.js
+++ b/devtools/client/webconsole/test/mochitest/browser_jsterm_accessibility.js
@@ -6,31 +6,35 @@
 // Tests that the autocomplete input is being blurred and focused when selecting a value.
 // This will help screen-readers notify users of the value that was set in the input.
 
 "use strict";
 
 const TEST_URI = "data:text/html;charset=utf8,<p>test code completion";
 
 add_task(async function() {
-  const hud = await openNewTabAndConsole(TEST_URI);
+  // Only run test with legacy JsTerm
+  await pushPref("devtools.webconsole.jsterm.codeMirror", false);
 
-  const jsterm = hud.jsterm;
+  const {jsterm} = await openNewTabAndConsole(TEST_URI);
   const input = jsterm.inputNode;
 
   info("Test that the console input is not treated as a live region");
   ok(!isElementInLiveRegion(input), "Console input is not treated as a live region");
 
   info("Test the console input has no aria-activedescendant attribute");
   ok(!input.hasAttribute("aria-activedescendant"), "no aria-activedescendant");
 
   info("Type 'd' to open the autocomplete popup");
-  const onPopupOpen = jsterm.autocompletePopup.once("popup-opened");
-  autocomplete(jsterm, "d");
+  const {autocompletePopup} = jsterm;
+  const onPopupOpen = autocompletePopup.once("popup-opened");
+  EventUtils.sendString("d");
   await onPopupOpen;
+  ok(autocompletePopup.isOpen && autocompletePopup.itemCount > 0,
+    "Autocomplete popup is open and contains suggestions");
 
   info("Test the console input has an aria-activedescendant attribute");
   ok(input.hasAttribute("aria-activedescendant"), "aria-activedescendant");
 
   // Add listeners for focus and blur events.
   let wasBlurred = false;
   input.addEventListener("blur", () => {
     wasBlurred = true;
@@ -54,28 +58,16 @@ add_task(async function() {
   await onPopupClosed;
 
   ok(wasFocused, "jsterm input received a focus event");
 
   info("Test the console input has no aria-activedescendant attribute no more");
   ok(!input.hasAttribute("aria-activedescendant"), "no aria-activedescendant");
 });
 
-async function autocomplete(jsterm, value) {
-  const popup = jsterm.autocompletePopup;
-
-  await new Promise(resolve => {
-    jsterm.setInputValue(value);
-    jsterm.complete(jsterm.COMPLETE_HINT_ONLY, resolve);
-  });
-
-  ok(popup.isOpen && popup.itemCount > 0,
-    "Autocomplete popup is open and contains suggestions");
-}
-
 function isElementInLiveRegion(element) {
   if (!element) {
     return false;
   }
 
   if (element.hasAttribute("aria-live")) {
     return element.getAttribute("aria-live") !== "off";
   }