Bug 1425972 - Add a test for subview navigation on space keydown. r=Gijs
authorIan Moody <moz-ian@perix.co.uk>
Wed, 20 Dec 2017 16:48:19 +0000
changeset 449004 17e9932698582f1e459479963db0fa6ef8e3257d
parent 449003 f3338a8c66a9094e63b017052f7cee2d4fb5e03a
child 449005 9d5cf07bbab182f4a04699c62e3f3fe4a2e2e1bd
push id8527
push userCallek@gmail.com
push dateThu, 11 Jan 2018 21:05:50 +0000
treeherdermozilla-beta@95342d212a7a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersGijs
bugs1425972
milestone59.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 1425972 - Add a test for subview navigation on space keydown. r=Gijs MozReview-Commit-ID: Hb5WlqOtibS
browser/components/customizableui/test/browser_panel_keyboard_navigation.js
--- a/browser/components/customizableui/test/browser_panel_keyboard_navigation.js
+++ b/browser/components/customizableui/test/browser_panel_keyboard_navigation.js
@@ -200,8 +200,39 @@ add_task(async function testInterleavedT
 
   Assert.equal(document.commandDispatcher.focusedElement, buttons[buttons.length - 1],
     "The last button should be focused after a mix of Tab and ArrowDown");
 
   promise = promisePanelHidden(window);
   PanelUI.hide();
   await promise;
 });
+
+add_task(async function testSpaceDownAfterTabNavigation() {
+  let promise = promisePanelShown(window);
+  PanelUI.show();
+  await promise;
+
+  let buttons = gHelperInstance._getNavigableElements(PanelUI.mainView);
+  let button;
+
+  for (button of buttons) {
+    if (button.disabled)
+      continue;
+    EventUtils.synthesizeKey("KEY_Tab", { code: "Tab" });
+    if (button.id == kHelpButtonId) {
+      break;
+    }
+  }
+
+  Assert.equal(document.commandDispatcher.focusedElement, button,
+               "Help button should be focused after tabbing to it.");
+
+  // Pressing down space on a button that points to a subview should navigate us
+  // there, before keyup.
+  promise = BrowserTestUtils.waitForEvent(PanelUI.helpView, "ViewShown");
+  EventUtils.synthesizeKey(" ", { code: "Space", type: "keydown" });
+  await promise;
+
+  promise = promisePanelHidden(window);
+  PanelUI.hide();
+  await promise;
+});