/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
addAccessibleTask(
`
ARIA button
ARIA log
ARIA main
ARIA region
ARIA directory
ARIA alertdialog
ARIA feed
ARIA rowgroup
ARIA searchbox
unknown ARIA role
HTML mainHTML headerHTML header inside sectionHTML region
HTML tbody
HTML implicit gridcell
HTML div
HTML span
`,
async function (browser, docAcc) {
function testComputedARIARole(id, role) {
const acc = findAccessibleChildByID(docAcc, id);
is(acc.computedARIARole, role, `computedARIARole for ${id} is correct`);
}
testComputedARIARole("ariaButton", "button");
testComputedARIARole("ariaLog", "log");
// Landmarks map to a single Gecko role.
testComputedARIARole("ariaMain", "main");
testComputedARIARole("ariaRegion", "region");
// Unnamed ARIA regions should ignore the ARIA role.
testComputedARIARole("ariaUnnamedRegion", "navigation");
// The directory ARIA role is an alias of list.
testComputedARIARole("ariaDirectory", "list");
// alertdialog, feed, rowgroup and searchbox map to a Gecko role, but it
// isn't unique.
testComputedARIARole("ariaAlertdialog", "alertdialog");
testComputedARIARole("ariaFeed", "feed");
testComputedARIARole("ariaRowgroup", "rowgroup");
testComputedARIARole("ariaSearchbox", "searchbox");
testComputedARIARole("ariaUnknown", "generic");
testComputedARIARole("htmlButton", "button");
// There is only a single ARIA role for buttons, but Gecko uses different
// roles depending on states.
testComputedARIARole("toggleButton", "button");
testComputedARIARole("htmlMain", "main");
testComputedARIARole("htmlHeader", "banner");
// only maps to the region ARIA role if it has a label.
testComputedARIARole("htmlSection", "generic");
// only maps to the banner role if it is not a child of a
// sectioning element.
testComputedARIARole("htmlSectionHeader", "generic");
testComputedARIARole("htmlRegion", "region");
// Gecko doesn't have a rowgroup role. Ensure we differentiate for
// computedARIARole.
testComputedARIARole("htmlFieldset", "group");
testComputedARIARole("htmlTbody", "rowgroup");
//
inside
implicitly maps to ARIA gridcell.
testComputedARIARole("htmlGridcell", "gridcell");
// Test generics.
testComputedARIARole("htmlDiv", "generic");
testComputedARIARole("htmlSpan", "generic");
// Some roles can't be mapped to ARIA role tokens.
testComputedARIARole("iframe", "");
},
{ chrome: true, topLevel: true }
);