Bug 1841381 - Fix browser_html_detail_view.js betasim perma failure. r=extension-reviewers,robwu

The test was accessing the role DOM attribute as a property of the
DOM element, reflecting that DOM attribute into a DOM element
property is currently gated by the "accessibility.ARIAReflection.enabled"
pref (which is currently set to true only in Nightly).

The perma failure while running on beta is fixed by this patch by accessing
the role DOM attribute using getAttribute (which works as expected on
both nightly and beta builds).

Differential Revision: https://phabricator.services.mozilla.com/D182633
This commit is contained in:
Luca Greco 2023-07-02 16:15:50 +00:00
Родитель 377011cc9e
Коммит 7069822ab0
1 изменённых файлов: 6 добавлений и 2 удалений

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

@ -44,7 +44,7 @@ async function checkLabel(row, name) {
await doc.l10n.translateElements([row]);
const rowHeaderEl = row.firstElementChild;
is(doc.l10n.getAttributes(rowHeaderEl).id, id, `The ${name} label is set`);
if (row.role === "group") {
if (row.getAttribute("role") === "group") {
// For the rows on which the role="group" attribute is set,
// let's make sure that the element itself includes an aria-label
// which provides to the screen reader a label similar to the one
@ -79,7 +79,11 @@ async function checkRowScreenReaderAccessibility(
// to the fluent ids (which would make translateElements to reject
// and the test to fail explicitly).
await doc.l10n.translateElements([row]);
is(row.role, "group", `Expect ${groupName} row to have role group`);
is(
row.getAttribute("role"),
"group",
`Expect ${groupName} row to have role group`
);
is(
doc.l10n.getAttributes(row).id,
expectedFluentId,