/* 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 }); addAccessibleTask( `
cell1 cell2
cell3 cell4
`, async function (browser, accDoc) { let getAcc = id => findAccessibleChildByID(accDoc, id); // //////////////////////////////////////////////////////////////////////// // ARIA grid testGroupAttrs(getAcc("grid_row1"), 1, 2); testAbsentAttrs(getAcc("grid_cell1"), { posinset: "", setsize: "" }); testAbsentAttrs(getAcc("grid_cell2"), { posinset: "", setsize: "" }); testGroupAttrs(getAcc("grid_row2"), 2, 2); testAbsentAttrs(getAcc("grid_cell3"), { posinset: "", setsize: "" }); testAbsentAttrs(getAcc("grid_cell4"), { posinset: "", setsize: "" }); testGroupParentAttrs(getAcc("grid"), 2, false, false); }, { topLevel: true, iframe: true, remoteIframe: true, chrome: true, } ); addAccessibleTask( `
cell1
cell2
cell1
cell2
cell1
cell2
`, async function (browser, accDoc) { let getAcc = id => findAccessibleChildByID(accDoc, id); // //////////////////////////////////////////////////////////////////////// // ARIA treegrid testGroupAttrs(getAcc("treegrid_row1"), 1, 2, 1); testAbsentAttrs(getAcc("treegrid_cell1"), { posinset: "", setsize: "" }); testAbsentAttrs(getAcc("treegrid_cell2"), { posinset: "", setsize: "" }); testGroupAttrs(getAcc("treegrid_row2"), 1, 1, 2); testAbsentAttrs(getAcc("treegrid_cell3"), { posinset: "", setsize: "" }); testAbsentAttrs(getAcc("treegrid_cell4"), { posinset: "", setsize: "" }); testGroupAttrs(getAcc("treegrid_row3"), 2, 2, 1); testAbsentAttrs(getAcc("treegrid_cell5"), { posinset: "", setsize: "" }); testAbsentAttrs(getAcc("treegrid_cell6"), { posinset: "", setsize: "" }); testGroupParentAttrs(getAcc("treegrid"), 2, true); // row child item count provided by parent grid's aria-colcount testGroupParentAttrs(getAcc("treegrid_row1"), 4, false); }, { topLevel: true, iframe: true, remoteIframe: true, chrome: true, } ); addAccessibleTask( `

heading1

heading2

heading3

heading4

heading5
heading6
ariaHeadingNoLevel
`, async function (browser, accDoc) { let getAcc = id => findAccessibleChildByID(accDoc, id); // //////////////////////////////////////////////////////////////////////// // HTML headings testGroupAttrs(getAcc("h1"), 0, 0, 1); testGroupAttrs(getAcc("h2"), 0, 0, 2); testGroupAttrs(getAcc("h3"), 0, 0, 3); testGroupAttrs(getAcc("h4"), 0, 0, 4); testGroupAttrs(getAcc("h5"), 0, 0, 5); testGroupAttrs(getAcc("h6"), 0, 0, 6); testGroupAttrs(getAcc("ariaHeadingNoLevel"), 0, 0, 2); // No child item counts or "tree" flag for parent of headings testAbsentAttrs(getAcc("headings"), { "child-item-count": "", tree: "" }); }, { topLevel: true, iframe: true, remoteIframe: true, chrome: true, } ); addAccessibleTask( ``, async function (browser, accDoc) { let getAcc = id => findAccessibleChildByID(accDoc, id); // //////////////////////////////////////////////////////////////////////// // ARIA combobox testGroupAttrs(getAcc("combo1_opt1"), 1, 4); testGroupAttrs(getAcc("combo1_opt2"), 2, 4); testGroupAttrs(getAcc("combo1_opt3"), 3, 4); testGroupAttrs(getAcc("combo1_opt4"), 4, 4); testGroupParentAttrs(getAcc("combo1"), 4, false); }, { topLevel: true, iframe: true, remoteIframe: true, chrome: true, } ); addAccessibleTask( `
cell
`, async function (browser, accDoc) { let getAcc = id => findAccessibleChildByID(accDoc, id); // //////////////////////////////////////////////////////////////////////// // ARIA table testGroupAttrs(getAcc("table_cell"), 3, 4); testGroupAttrs(getAcc("table_row"), 2, 2); // grid child item count provided by aria-rowcount testGroupParentAttrs(getAcc("table"), 2, false); // row child item count provided by parent grid's aria-colcount testGroupParentAttrs(getAcc("table_row"), 4, false); }, { topLevel: true, iframe: true, remoteIframe: true, chrome: true, } ); addAccessibleTask( `
cell content
cell content
`, async function (browser, accDoc) { let getAcc = id => findAccessibleChildByID(accDoc, id); // Attributes calculated even when row is wrapped in a div. testGroupAttrs(getAcc("wrapped_row_1"), 1, 2, null); testGroupAttrs(getAcc("wrapped_row_2"), 2, 2, null); }, { topLevel: true, iframe: true, remoteIframe: true, chrome: true, } ); addAccessibleTask( `
Apples
Oranges
Bananas
`, async function (browser, accDoc) { let getAcc = id => findAccessibleChildByID(accDoc, id); // //////////////////////////////////////////////////////////////////////// // ARIA list constructed by ARIA owns testGroupAttrs(getAcc("t1_li1"), 1, 3); testGroupAttrs(getAcc("t1_li2"), 2, 3); testGroupAttrs(getAcc("t1_li3"), 3, 3); testGroupParentAttrs(getAcc("aria-list_4"), 3, false); }, { topLevel: true, iframe: true, remoteIframe: true, chrome: true, } ); addAccessibleTask( `
`, async function (browser, accDoc) { let getAcc = id => findAccessibleChildByID(accDoc, id); // Test group attributes of ARIA comments testGroupAttrs(getAcc("comm_single_1"), 1, 2, 1); testGroupAttrs(getAcc("comm_single_2"), 2, 2, 1); testGroupAttrs(getAcc("comm_nested_1"), 1, 3, 1); testGroupAttrs(getAcc("comm_nested_1_1"), 1, 2, 2); testGroupAttrs(getAcc("comm_nested_1_2"), 2, 2, 2); testGroupAttrs(getAcc("comm_nested_2"), 2, 3, 1); testGroupAttrs(getAcc("comm_nested_2_1"), 1, 1, 2); testGroupAttrs(getAcc("comm_nested_2_1_1"), 1, 1, 3); testGroupAttrs(getAcc("comm_nested_3"), 3, 3, 1); }, { topLevel: true, iframe: true, remoteIframe: true, chrome: true, } ); addAccessibleTask( `
Item 1
Item 2
`, async function (browser, accDoc) { let getAcc = id => findAccessibleChildByID(accDoc, id); // Test that group position information updates after deleting node. testGroupAttrs(getAcc("tree4_ti1"), 1, 2, 1); testGroupAttrs(getAcc("tree4_ti2"), 2, 2, 1); testGroupParentAttrs(getAcc("tree4"), 2, true); let p = waitForEvent(EVENT_REORDER, "tree4"); invokeContentTask(browser, [], () => { content.document.getElementById("tree4_ti1").remove(); }); await p; testGroupAttrs(getAcc("tree4_ti2"), 1, 1, 1); testGroupParentAttrs(getAcc("tree4"), 1, true); }, { topLevel: true, iframe: true, remoteIframe: true, chrome: true, } ); // Verify that intervening SECTION accs in ARIA compound widgets do not split // up the group info for descendant owned elements. Test various types of // widgets that should all be treated the same. addAccessibleTask( `
treeitem 1
treeitem 2
option 1
option 2
listitem 1
listitem 2
`, async function (browser, accDoc) { let getAcc = id => findAccessibleChildByID(accDoc, id); testGroupAttrs(getAcc("ti1"), 1, 2, 1); testGroupAttrs(getAcc("ti2"), 2, 2, 1); testGroupAttrs(getAcc("opt1"), 1, 2, 0); testGroupAttrs(getAcc("opt2"), 2, 2, 0); testGroupAttrs(getAcc("li1"), 1, 2, 0); testGroupAttrs(getAcc("li2"), 2, 2, 0); testGroupAttrs(getAcc("mi1"), 1, 2, 0); testGroupAttrs(getAcc("mi2"), 2, 2, 0); testGroupAttrs(getAcc("r1"), 1, 2, 0); testGroupAttrs(getAcc("r2"), 2, 2, 0); }, { topLevel: true, iframe: true, remoteIframe: true, chrome: true, } ); // Verify that non-generic accessibles (like buttons) correctly split the group // info of descendant owned elements. addAccessibleTask( `
first
second
`, async function (browser, accDoc) { let getAcc = id => findAccessibleChildByID(accDoc, id); testGroupAttrs(getAcc("ti1"), 1, 1, 1); testGroupAttrs(getAcc("ti2"), 1, 1, 1); }, { topLevel: true, iframe: true, remoteIframe: true, chrome: true, } );