зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1483828 - [Part 6] Fix more tests caused by root element focusing behaviour update r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D202874
This commit is contained in:
Родитель
3efbd66e3f
Коммит
5ba9cd445b
|
@ -47,7 +47,17 @@
|
|||
|
||||
// focus on not editable document
|
||||
gQueue.push(new synthFocus(frame2InputAcc));
|
||||
gQueue.push(new synthShiftTab(frame2DocAcc, new focusChecker(frame2DocAcc)));
|
||||
var canTabMoveFocusToRootElement =
|
||||
!SpecialPowers.getBoolPref("dom.disable_tab_focus_to_root_element");
|
||||
if (canTabMoveFocusToRootElement) {
|
||||
// Moves the focus to the root element
|
||||
gQueue.push(new synthShiftTab(frame2DocAcc, new focusChecker(frame2DocAcc)));
|
||||
} else {
|
||||
// Skips the root element, so the focus got moved to buttonAcc2.
|
||||
var buttonAcc2 = getAccessible("b2");
|
||||
gQueue.push(new synthShiftTab(buttonAcc2, new focusChecker(buttonAcc2)));
|
||||
}
|
||||
|
||||
|
||||
gQueue.invoke(); // Will call SimpleTest.finish();
|
||||
}
|
||||
|
|
|
@ -42,8 +42,19 @@ add_task(async function test_controllers_subframes() {
|
|||
|
||||
gURLBar.focus();
|
||||
|
||||
let canTabMoveFocusToRootElement = !SpecialPowers.getBoolPref(
|
||||
"dom.disable_tab_focus_to_root_element"
|
||||
);
|
||||
for (let stepNum = 0; stepNum < browsingContexts.length; stepNum++) {
|
||||
await keyAndUpdate(stepNum > 0 ? "VK_TAB" : "VK_F6", {}, 6);
|
||||
let useTab = stepNum > 0;
|
||||
// When canTabMoveFocusToRootElement is true, this kepress will move the
|
||||
// focus to a root element, which will trigger an extra "select" command
|
||||
// compare to the case when canTabMoveFocusToRootElement is false.
|
||||
await keyAndUpdate(
|
||||
useTab ? "VK_TAB" : "VK_F6",
|
||||
{},
|
||||
canTabMoveFocusToRootElement ? 6 : 4
|
||||
);
|
||||
|
||||
// Since focus may be switching into a separate process here,
|
||||
// need to wait for the focus to have been updated.
|
||||
|
@ -59,22 +70,35 @@ add_task(async function test_controllers_subframes() {
|
|||
goUpdateGlobalEditMenuItems(true);
|
||||
}
|
||||
|
||||
await SpecialPowers.spawn(browsingContexts[stepNum], [], () => {
|
||||
// Both the tab key and document navigation with F6 will focus
|
||||
// the root of the document within the frame.
|
||||
let document = content.document;
|
||||
Assert.equal(
|
||||
document.activeElement,
|
||||
document.documentElement,
|
||||
"root focused"
|
||||
);
|
||||
});
|
||||
// XXX Currently, Copy is always enabled when the root (not an editor element)
|
||||
// is focused. Possibly that should only be true if a listener is present?
|
||||
checkCommandState("step " + stepNum + " root focused", false, true, false);
|
||||
await SpecialPowers.spawn(
|
||||
browsingContexts[stepNum],
|
||||
[{ canTabMoveFocusToRootElement, useTab }],
|
||||
args => {
|
||||
// Both the tab key and document navigation with F6 will focus
|
||||
// the root of the document within the frame.
|
||||
// When dom.disable_tab_focus_to_root_element is true, only F6 will do this.
|
||||
let document = content.document;
|
||||
let expectedElement =
|
||||
args.canTabMoveFocusToRootElement || !args.useTab
|
||||
? document.documentElement
|
||||
: document.getElementById("input");
|
||||
Assert.equal(document.activeElement, expectedElement, "root focused");
|
||||
}
|
||||
);
|
||||
|
||||
// Tab to the textbox.
|
||||
await keyAndUpdate("VK_TAB", {}, 1);
|
||||
if (canTabMoveFocusToRootElement || !useTab) {
|
||||
// XXX Currently, Copy is always enabled when the root (not an editor element)
|
||||
// is focused. Possibly that should only be true if a listener is present?
|
||||
checkCommandState(
|
||||
"step " + stepNum + " root focused",
|
||||
false,
|
||||
true,
|
||||
false
|
||||
);
|
||||
|
||||
// Tab to the textbox.
|
||||
await keyAndUpdate("VK_TAB", {}, 1);
|
||||
}
|
||||
|
||||
if (AppConstants.platform != "macosx") {
|
||||
goUpdateGlobalEditMenuItems(true);
|
||||
|
|
Загрузка…
Ссылка в новой задаче