/* 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"; /* import-globals-from ../../mochitest/attributes.js */ loadScripts({ name: "attributes.js", dir: MOCHITESTS_DIR }); /** * select elements */ addAccessibleTask( ` `, async function (browser, accDoc) { let getAcc = id => findAccessibleChildByID(accDoc, id); // //////////////////////////////////////////////////////////////////////// // HTML select with no size attribute. testGroupAttrs(getAcc("opt1-nosize"), 1, 4); testGroupAttrs(getAcc("opt2-nosize"), 2, 4); testGroupAttrs(getAcc("opt3-nosize"), 3, 4); testGroupAttrs(getAcc("opt4-nosize"), 4, 4); // Container should have item count and not hierarchical testGroupParentAttrs(getAcc("opt1-nosize").parent, 4, false); // //////////////////////////////////////////////////////////////////////// // HTML select testGroupAttrs(getAcc("opt1"), 1, 2); testGroupAttrs(getAcc("opt2"), 2, 2); // //////////////////////////////////////////////////////////////////////// // HTML select with optgroup testGroupAttrs(getAcc("select2_opt3"), 1, 2, 1); testGroupAttrs(getAcc("select2_opt4"), 2, 2, 1); testGroupAttrs(getAcc("select2_opt1"), 1, 2, 2); testGroupAttrs(getAcc("select2_opt2"), 2, 2, 2); }, { topLevel: true, iframe: true, remoteIframe: true, chrome: true, } ); /** * HTML radios */ addAccessibleTask( `
`, async function (browser, accDoc) { let getAcc = id => findAccessibleChildByID(accDoc, id); // //////////////////////////////////////////////////////////////////////// // HTML input@type="radio" within form testGroupAttrs(getAcc("radio1"), 1, 2); testGroupAttrs(getAcc("radio2"), 2, 2); // //////////////////////////////////////////////////////////////////////// // HTML input@type="radio" within document testGroupAttrs(getAcc("radio3"), 1, 2); // radio4 is wrapped in a label testGroupAttrs(getAcc("radio4"), 2, 2); // //////////////////////////////////////////////////////////////////////// // Hidden HTML input@type="radio" testGroupAttrs(getAcc("radio5"), 1, 1); // //////////////////////////////////////////////////////////////////////// // HTML input@type="radio" with different name but same parent testGroupAttrs(getAcc("radio6"), 1, 1); // //////////////////////////////////////////////////////////////////////// // HTML input@type="radio" with no name testGroupAttrs(getAcc("radio7"), 0, 0); }, { topLevel: true, iframe: true, remoteIframe: true, chrome: true, } ); /** * lists */ addAccessibleTask( `
  1. Oranges
  2. Apples
  3. Bananas
Oranges Apples Bananas Oranges Apples Bananas Oranges Apples Bananas
Item 1
Item 1A
Item 1B
Item 2
Item 2A
Item 2B
`, async function (browser, accDoc) { let getAcc = id => findAccessibleChildByID(accDoc, id); // //////////////////////////////////////////////////////////////////////// // HTML ul/ol testGroupAttrs(getAcc("li1"), 1, 3); testGroupAttrs(getAcc("li2"), 2, 3); testGroupAttrs(getAcc("li3"), 3, 3); // ul should have item count and not hierarchical testGroupParentAttrs(getAcc("ul"), 3, false); // //////////////////////////////////////////////////////////////////////// // HTML ul/ol (nested lists) testGroupAttrs(getAcc("li4"), 1, 3, 1); testGroupAttrs(getAcc("li5"), 2, 3, 1); testGroupAttrs(getAcc("li6"), 3, 3, 1); // ol with nested list should have 1st level item count and be hierarchical testGroupParentAttrs(getAcc("ol"), 3, true); testGroupAttrs(getAcc("n_li4"), 1, 3, 2); testGroupAttrs(getAcc("n_li5"), 2, 3, 2); testGroupAttrs(getAcc("n_li6"), 3, 3, 2); // nested ol should have item count and be hierarchical testGroupParentAttrs(getAcc("ol_nested"), 3, true); // //////////////////////////////////////////////////////////////////////// // ARIA list testGroupAttrs(getAcc("li7"), 1, 3); testGroupAttrs(getAcc("li8"), 2, 3); testGroupAttrs(getAcc("li9"), 3, 3); // simple flat aria list testGroupParentAttrs(getAcc("aria-list_1"), 3, false); // //////////////////////////////////////////////////////////////////////// // ARIA list (nested lists: list -> listitem -> list -> listitem) testGroupAttrs(getAcc("li10"), 1, 3, 1); testGroupAttrs(getAcc("li11"), 2, 3, 1); testGroupAttrs(getAcc("li12"), 3, 3, 1); // aria list with nested list testGroupParentAttrs(getAcc("aria-list_2"), 3, true); testGroupAttrs(getAcc("n_li10"), 1, 3, 2); testGroupAttrs(getAcc("n_li11"), 2, 3, 2); testGroupAttrs(getAcc("n_li12"), 3, 3, 2); // nested aria list. testGroupParentAttrs(getAcc("aria-list_2_1"), 3, true); // //////////////////////////////////////////////////////////////////////// // ARIA list (nested lists: list -> listitem -> group -> listitem) testGroupAttrs(getAcc("lgt_li1"), 1, 2, 1); testGroupAttrs(getAcc("lgt_li1_nli1"), 1, 2, 2); testGroupAttrs(getAcc("lgt_li1_nli2"), 2, 2, 2); testGroupAttrs(getAcc("lgt_li2"), 2, 2, 1); testGroupAttrs(getAcc("lgt_li2_nli1"), 1, 2, 2); testGroupAttrs(getAcc("lgt_li2_nli2"), 2, 2, 2); // aria list with nested list testGroupParentAttrs(getAcc("aria-list_3"), 2, true); }, { topLevel: true, iframe: true, remoteIframe: true, chrome: true, } ); addAccessibleTask( ``, async function (browser, accDoc) { let getAcc = id => findAccessibleChildByID(accDoc, id); // //////////////////////////////////////////////////////////////////////// // ARIA menu (menuitem, separator, menuitemradio and menuitemcheckbox) testGroupAttrs(getAcc("menu_item1"), 1, 2); testGroupAttrs(getAcc("menu_item2"), 2, 2); testGroupAttrs(getAcc("menu_item1.1"), 1, 2); testGroupAttrs(getAcc("menu_item1.2"), 2, 2); testGroupAttrs(getAcc("menu_item1.3"), 1, 3); testGroupAttrs(getAcc("menu_item1.4"), 2, 3); testGroupAttrs(getAcc("menu_item1.5"), 3, 3); // menu bar item count testGroupParentAttrs(getAcc("menubar"), 2, false); // Bug 1492529. Menu should have total number of items 5 from both sets, // but only has the first 2 item set. todoAttr(getAcc("menu"), "child-item-count", "5"); }, { topLevel: true, iframe: true, remoteIframe: true, chrome: true, } ); addAccessibleTask( ``, async function (browser, accDoc) { let getAcc = id => findAccessibleChildByID(accDoc, id); // //////////////////////////////////////////////////////////////////////// // ARIA tab testGroupAttrs(getAcc("tab_1"), 1, 3); testGroupAttrs(getAcc("tab_2"), 2, 3); testGroupAttrs(getAcc("tab_3"), 3, 3); // tab list tab count testGroupParentAttrs(getAcc("tablist_1"), 3, false); }, { topLevel: true, iframe: true, remoteIframe: true, chrome: true, } ); addAccessibleTask( ``, async function (browser, accDoc) { let getAcc = id => findAccessibleChildByID(accDoc, id); // //////////////////////////////////////////////////////////////////////// // ARIA radio testGroupAttrs(getAcc("r1"), 1, 3); testGroupAttrs(getAcc("r2"), 2, 3); testGroupAttrs(getAcc("r3"), 3, 3); // explicit aria radio group testGroupParentAttrs(getAcc("rg1"), 3, false); }, { topLevel: true, iframe: true, remoteIframe: true, chrome: true, } ); addAccessibleTask( `
vegetables
cucumber
carrot
mercedes
BMW
Audi
people