tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 771ac28b36637a86154b826ace7b23a2469c728b
parent bab020d8bfbbfdf6609f44bf11389cb2c4ff8a2a
Author: Eitan Isaacson <eitan@monotonous.org>
Date:   Tue, 18 Nov 2025 18:13:45 +0000

Bug 2000098 - P2: Migrate test_ARIACore_examples.html. r=morgan

Differential Revision: https://phabricator.services.mozilla.com/D272547

Diffstat:
Maccessible/tests/browser/name_and_description/browser_name_general.js | 68++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Maccessible/tests/mochitest/name/a11y.toml | 2--
Daccessible/tests/mochitest/name/test_ARIACore_examples.html | 90-------------------------------------------------------------------------------
3 files changed, 68 insertions(+), 92 deletions(-)

diff --git a/accessible/tests/browser/name_and_description/browser_name_general.js b/accessible/tests/browser/name_and_description/browser_name_general.js @@ -185,3 +185,71 @@ addAccessibleTask( }, { topLevel: true, chrome: true } ); + +/* + * All test cases taken from https://www.w3.org/TR/accname-1.1/ + * These were especially called out to demonstrate edge cases. + * (migrated from mochitest/name/test_ARIACore_examples.html) + */ +addAccessibleTask( + ` + <!-- el1 should be labeled, el2 should not. --> + <div id="el1" aria-labelledby="el3"></div> + <div id="el2" aria-labelledby="el1"></div> + <div id="el3"> hello </div> + + <!-- The buttons should be labeled by themselves and the referenced link --> + <ul> + <li> + <a id="file_row1" href="./files/Documentation.pdf">Documentation.pdf</a> + <span role="button" tabindex="0" id="del_row1" aria-label="Delete" + aria-labelledby="del_row1 file_row1"></span> + </li> + <li> + <a id="file_row2" href="./files/HolidayLetter.pdf">HolidayLetter.pdf</a> + <span role="button" tabindex="0" id="del_row2" aria-label="Delete" + aria-labelledby="del_row2 file_row2"></span> + </li> + </ul> + + <!-- Label from combined text and subtree --> + <div id="chkbx" role="checkbox" aria-checked="false">Flash the screen + <span role="textbox" aria-multiline="false"> 5 </span> times</div> + + <!-- Label with name from content should include table --> + <input id="input_with_html_label" /> + <label for="input_with_html_label" id="label"> + <div>foo</div> + <table><tr><td>bar</td></tr></table> + <div>baz</div> + </label> +`, + async function testARIACoreExamples(browser, docAcc) { + function testName_(id, expected) { + const acc = findAccessibleChildByID(docAcc, id); + testName(acc, expected); + } + // Example 1 from section 4.3.1 under 2.B. + // Element1 should get its name from the text in element3. + // Element2 should not get its name from element1 because that already + // gets its name from another element. + testName_("el1", "hello"); + testName_("el2", null); + + // Example 2 from section 4.3.1 under 2.C. + // The buttons should get their name from their labels and the links. + testName_("del_row1", "Delete Documentation.pdf"); + testName_("del_row2", "Delete HolidayLetter.pdf"); + + // Example 3 from section 4.3.1 under 2.F. + // Name should be own content text plus the value of the input plus + // more own inner text, separated by 1 space. + testName_("chkbx", "Flash the screen 5 times"); + + // Example 4 from section 4.3.1 under 2.F. + // Name from content should include all the child nodes, including + // table cells. + testName_("input_with_html_label", "foo bar baz"); + }, + { topLevel: true, chrome: true } +); diff --git a/accessible/tests/mochitest/name/a11y.toml b/accessible/tests/mochitest/name/a11y.toml @@ -5,8 +5,6 @@ support-files = [ "!/accessible/tests/mochitest/*.js", "!/accessible/tests/mochitest/moz.png"] -["test_ARIACore_examples.html"] - ["test_browserui.xhtml"] ["test_counterstyle.html"] diff --git a/accessible/tests/mochitest/name/test_ARIACore_examples.html b/accessible/tests/mochitest/name/test_ARIACore_examples.html @@ -1,90 +0,0 @@ -<!DOCTYPE html> -<html> - -<head> - <title>Testing a11y name ccomputation testcases</title> - - <link rel="stylesheet" - type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" /> - - <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> - - <script type="application/javascript" - src="../common.js"></script> - <script type="application/javascript" - src="../name.js"></script> - - <script type="application/javascript"> - function doTest() { - // All test cases taken from https://www.w3.org/TR/accname-1.1/ - // These were especially called out to demonstrate edge cases. - - // Example 1 from section 4.3.1 under 2.B. - // Element1 should get its name from the text in element3. - // Element2 should not gets name from element1 because that already - // gets its name from another element. - testName("el1", "hello"); - testName("el2", null); - - // Example 2 from section 4.3.1 under 2.C. - // The buttons should get their name from their labels and the links. - testName("del_row1", "Delete Documentation.pdf"); - testName("del_row2", "Delete HolidayLetter.pdf"); - - // Example 3 from section 4.3.1 under 2.F. - // Name should be own content text plus the value of the input plus - // more own inner text, separated by 1 space. - testName("chkbx", "Flash the screen 5 times"); - - // Example 4 from section 4.3.1 under 2.F. - // Name from content should include all the child nodes, including - // table cells. - testName("input_with_html_label", "foo bar baz"); - - SimpleTest.finish(); - } - - SimpleTest.waitForExplicitFinish(); - addA11yLoadEvent(doTest); - </script> - -</head> -<body> - <p id="display"></p> - <div id="content" style="display: none"></div> - <pre id="test"> - </pre> - - <!-- el1 should be labeled, el2 should not. --> - <div id="el1" aria-labelledby="el3"></div> - <div id="el2" aria-labelledby="el1"></div> - <div id="el3"> hello </div> - - <!-- The buttons should be labeled by themselves and the referenced link --> - <ul> - <li> - <a id="file_row1" href="./files/Documentation.pdf">Documentation.pdf</a> - <span role="button" tabindex="0" id="del_row1" aria-label="Delete" - aria-labelledby="del_row1 file_row1"></span> - </li> - <li> - <a id="file_row2" href="./files/HolidayLetter.pdf">HolidayLetter.pdf</a> - <span role="button" tabindex="0" id="del_row2" aria-label="Delete" - aria-labelledby="del_row2 file_row2"></span> - </li> - </ul> - - <!-- Label from combined text and subtree --> - <div id="chkbx" role="checkbox" aria-checked="false">Flash the screen - <span role="textbox" aria-multiline="false"> 5 </span> times</div> - - <!-- Label with name from content should include table --> - <input id="input_with_html_label" /> - <label for="input_with_html_label" id="label"> - <div>foo</div> - <table><tr><td>bar</td></tr></table> - <div>baz</div> - </label> - -</body> -</html>