Bug 1700845: Make accessible/tests/mochitest/events/test_focus_listcontrols.xhtml click the menulist at the centre, not the top left. r=morgan

Clicking at the top left previously worked, but doesn't work with browser.proton.enabled.

1. Support a { where: "center" } argument to synthClick in events.js.
2. Use that in the test.

Differential Revision: https://phabricator.services.mozilla.com/D109689
This commit is contained in:
James Teh 2021-03-25 23:08:35 +00:00
Родитель f96f5a0678
Коммит 599e149915
2 изменённых файлов: 17 добавлений и 6 удалений

Просмотреть файл

@ -1251,11 +1251,21 @@ function synthClick(aNodeOrID, aCheckerOrEventSeq, aArgs) {
var x = 1,
y = 1;
if (aArgs && "where" in aArgs && aArgs.where == "right") {
if (isHTMLElement(targetNode)) {
x = targetNode.offsetWidth - 1;
} else if (isXULElement(targetNode)) {
x = targetNode.getBoundingClientRect().width - 1;
if (aArgs && "where" in aArgs) {
if (aArgs.where == "right") {
if (isHTMLElement(targetNode)) {
x = targetNode.offsetWidth - 1;
} else if (isXULElement(targetNode)) {
x = targetNode.getBoundingClientRect().width - 1;
}
} else if (aArgs.where == "center") {
if (isHTMLElement(targetNode)) {
x = targetNode.offsetWidth / 2;
y = targetNode.offsetHeight / 2;
} else if (isXULElement(targetNode)) {
x = targetNode.getBoundingClientRect().width / 2;
y = targetNode.getBoundingClientRect().height / 2;
}
}
}
synthesizeMouse(targetNode, x, y, aArgs ? aArgs : {});

Просмотреть файл

@ -46,7 +46,8 @@
gQueue.push(new synthFocus("emptyrichlistbox", new focusChecker("emptyrichlistbox")));
gQueue.push(new synthFocus("menulist"));
gQueue.push(new synthClick("menulist", new focusChecker("ml_tangerine")));
gQueue.push(new synthClick("menulist", new focusChecker("ml_tangerine"),
{ where: "center" }));
gQueue.push(new synthDownKey("ml_tangerine", new focusChecker("ml_marmalade")));
gQueue.push(new synthEscapeKey("ml_marmalade", new focusChecker("menulist")));