1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
7 * Tests that are related to the accessibility of the Firefox View
8 * document. These tasks tend to be privileged content, not browser
12 add_setup(async function setup() {
13 // Make sure the prompt to connect FxA doesn't show
14 // Without resetting the view-count pref it gets surfaced after
15 // the third click on the fx view toolbar button.
16 await SpecialPowers.pushPrefEnv({
18 ["browser.firefox-view.view-count", 0],
19 ["browser.tabs.firefox-view-next", false],
22 registerCleanupFunction(async () => {
23 await SpecialPowers.popPrefEnv();
27 add_task(async function test_keyboard_focus_after_tab_pickup_opened() {
28 // Reset various things touched by other tests in this file so that
29 // we have a sufficiently clean environment.
31 TabsSetupFlowManager.resetInternalState();
33 // Ensure that the tab-pickup section doesn't need to be opened.
34 Services.prefs.clearUserPref(
35 "browser.tabs.firefox-view.ui-state.tab-pickup.open"
38 // Let's be deterministic about the basic UI state!
39 const sandbox = setupMocks({
40 state: UIState.STATUS_NOT_CONFIGURED,
44 await withFirefoxView({}, async browser => {
45 const { document } = browser.contentWindow;
46 let win = browser.ownerGlobal;
49 document.activeElement.localName,
51 "document body element is initially focused"
55 info("Tab keypress synthesized");
56 EventUtils.synthesizeKey("KEY_Tab", {}, win);
61 let tabPickupContainer = document.querySelector(
62 "#tab-pickup-container summary.page-section-header"
65 document.activeElement,
67 "tab pickup container header has focus"
73 document.activeElement.id,
74 "firefoxview-tabpickup-step-signin-primarybutton",
75 "tab pickup primary button has focus"
80 await tearDown(sandbox);
83 add_task(async function test_keyboard_accessibility_tab_pickup() {
84 await withFirefoxView({}, async browser => {
85 const win = browser.ownerGlobal;
86 const { document } = browser.contentWindow;
87 const enter = async () => {
89 EventUtils.synthesizeKey("KEY_Enter", {}, win);
91 let details = document.getElementById("tab-pickup-container");
92 let summary = details.querySelector("summary");
93 ok(summary, "summary element should exist");
94 ok(details.open, "Tab pickup container should be initially open on load");
97 ok(!details.open, "Tab pickup container should be closed");
99 ok(details.open, "Tab pickup container should be opened");
101 cleanup_tab_pickup();