diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
commit | 2aa4a82499d4becd2284cdb482213d541b8804dd (patch) | |
tree | b80bf8bf13c3766139fbacc530efd0dd9d54394c /accessible/tests/mochitest/value | |
parent | Initial commit. (diff) | |
download | firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.tar.xz firefox-2aa4a82499d4becd2284cdb482213d541b8804dd.zip |
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | accessible/tests/mochitest/value.js | 52 | ||||
-rw-r--r-- | accessible/tests/mochitest/value/a11y.ini | 9 | ||||
-rw-r--r-- | accessible/tests/mochitest/value/test_ariavalue.html | 68 | ||||
-rw-r--r-- | accessible/tests/mochitest/value/test_general.html | 159 | ||||
-rw-r--r-- | accessible/tests/mochitest/value/test_number.html | 56 | ||||
-rw-r--r-- | accessible/tests/mochitest/value/test_progress.html | 61 | ||||
-rw-r--r-- | accessible/tests/mochitest/value/test_range.html | 59 |
7 files changed, 464 insertions, 0 deletions
diff --git a/accessible/tests/mochitest/value.js b/accessible/tests/mochitest/value.js new file mode 100644 index 0000000000..379403ecaf --- /dev/null +++ b/accessible/tests/mochitest/value.js @@ -0,0 +1,52 @@ +/* import-globals-from common.js */ + +// ////////////////////////////////////////////////////////////////////////////// +// Public methods + +/** + * Tests nsIAccessibleValue interface. + * + * @param aAccOrElmOrId [in] identifier of accessible + * @param aValue [in] accessible value (nsIAccessible::value) + * @param aCurrValue [in] current value (nsIAccessibleValue::currentValue) + * @param aMinValue [in] minimum value (nsIAccessibleValue::minimumValue) + * @param aMaxValue [in] maximumn value (nsIAccessibleValue::maximumValue) + * @param aMinIncr [in] minimum increment value + * (nsIAccessibleValue::minimumIncrement) + */ +function testValue( + aAccOrElmOrId, + aValue, + aCurrValue, + aMinValue, + aMaxValue, + aMinIncr +) { + var acc = getAccessible(aAccOrElmOrId, [nsIAccessibleValue]); + if (!acc) { + return; + } + + is(acc.value, aValue, "Wrong value of " + prettyName(aAccOrElmOrId)); + + is( + acc.currentValue, + aCurrValue, + "Wrong current value of " + prettyName(aAccOrElmOrId) + ); + is( + acc.minimumValue, + aMinValue, + "Wrong minimum value of " + prettyName(aAccOrElmOrId) + ); + is( + acc.maximumValue, + aMaxValue, + "Wrong maximum value of " + prettyName(aAccOrElmOrId) + ); + is( + acc.minimumIncrement, + aMinIncr, + "Wrong minimum increment value of " + prettyName(aAccOrElmOrId) + ); +} diff --git a/accessible/tests/mochitest/value/a11y.ini b/accessible/tests/mochitest/value/a11y.ini new file mode 100644 index 0000000000..8ebcf83f0c --- /dev/null +++ b/accessible/tests/mochitest/value/a11y.ini @@ -0,0 +1,9 @@ +[DEFAULT] +support-files = + !/accessible/tests/mochitest/*.js + +[test_ariavalue.html] +[test_general.html] +[test_number.html] +[test_progress.html] +[test_range.html] diff --git a/accessible/tests/mochitest/value/test_ariavalue.html b/accessible/tests/mochitest/value/test_ariavalue.html new file mode 100644 index 0000000000..fa240e082e --- /dev/null +++ b/accessible/tests/mochitest/value/test_ariavalue.html @@ -0,0 +1,68 @@ +<html> + +<head> + <title>nsIAccessible value testing for implicit aria-value* attributes</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="../value.js"></script> + + <script src="chrome://mochikit/content/chrome-harness.js"></script> + + <script type="application/javascript"> + function doTest() { + for (const role of ["slider", "scrollbar"]) { + testValue(`${role}_default`, "50", 50, 0, 100, 0); + testValue(`${role}_min1max50`, "25.5", 25.5, 1, 50, 0); + testValue(`${role}_max200`, "100", 100, 0, 200, 0); + testValue(`${role}_min10`, "55", 55, 10, 100, 0); + testValue(`${role}_vt`, "juice", 50, 0, 100, 0); + testValue(`${role}_vn`, "6", 6, 0, 100, 0); + testValue(`${role}_vtvn`, "juice", 6, 0, 100, 0); + } + + SimpleTest.finish(); + } + + SimpleTest.waitForExplicitFinish(); + addA11yLoadEvent(doTest); + </script> + +</head> + +<body> + + <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1357071" + title="Add support for implicit values for aria-value* attributes for scrollbar and slider roles"> + Bug 1357071 + </a> + + <p id="display"></p> + <div id="content" style="display: none"> + </div> + <pre id="test"> + </pre> + + <!-- ARIA sliders --> + <div id="slider_default" role="slider">vanilla slider</div> + <div id="slider_min1max50" role="slider" aria-valuemin="1" aria-valuemax="50">banana slider</div> + <div id="slider_max200" role="slider" aria-valuemax="200">cherry slider</div> + <div id="slider_min10" role="slider" aria-valuemin="10">strawberry slider</div> + <div id="slider_vt" role="slider" aria-valuetext="juice">orange slider</div> + <div id="slider_vn" role="slider" aria-valuenow="6">chocolate slider</div> + <div id="slider_vtvn" role="slider" aria-valuetext="juice" aria-valuenow="6">apple slider</div> + + <!-- ARIA scrollbars --> + <div id="scrollbar_default" role="scrollbar">vanilla scrollbar</div> + <div id="scrollbar_min1max50" role="scrollbar" aria-valuemin="1" aria-valuemax="50">banana scrollbar</div> + <div id="scrollbar_max200" role="scrollbar" aria-valuemax="200">cherry scrollbar</div> + <div id="scrollbar_min10" role="scrollbar" aria-valuemin="10">strawberry scrollbar</div> + <div id="scrollbar_vt" role="scrollbar" aria-valuetext="juice">orange scrollbar</div> + <div id="scrollbar_vn" role="scrollbar" aria-valuenow="6">chocolate scrollbar</div> + <div id="scrollbar_vtvn" role="scrollbar" aria-valuetext="juice" aria-valuenow="6">apple scrollbar</div> +</body> + +</html> diff --git a/accessible/tests/mochitest/value/test_general.html b/accessible/tests/mochitest/value/test_general.html new file mode 100644 index 0000000000..862c5254c0 --- /dev/null +++ b/accessible/tests/mochitest/value/test_general.html @@ -0,0 +1,159 @@ +<html> + +<head> + <title>nsIAccessible value testing</title> + + <link rel="stylesheet" type="text/css" + href="chrome://mochikit/content/tests/SimpleTest/test.css" /> + + <style type="text/css"> + .offscreen { + position: absolute; + left: -5000px; + top: -5000px; + height: 100px; + width: 100px; + } + </style> + + <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> + + <script type="application/javascript" + src="../common.js"></script> + + <script src="chrome://mochikit/content/chrome-harness.js"></script> + + <script type="application/javascript"> + function doTest() { + function testValue(aID, aValue) { + var acc = getAccessible(aID); + if (!acc) + return; + is(acc.value, aValue, "Wrong value for " + aID + "!"); + } + + var href = getRootDirectory(window.location.href) + "foo"; + + // roles that can't live as HTMLLinkAccessibles + testValue("aria_menuitem_link", ""); + testValue("aria_button_link", ""); + testValue("aria_checkbox_link", ""); + testValue("aria_application_link", ""); + testValue("aria_main_link", ""); + testValue("aria_navigation_link", ""); + + // roles that can live as HTMLLinkAccessibles + testValue("aria_link_link", href); + + // //////////////////////////////////////////////////////////////////////// + // ARIA textboxes + + testValue("aria_textbox1", "helo"); + // Textbox containing list. + testValue("aria_textbox2", "1. test"); + + // //////////////////////////////////////////////////////////////////////// + // ARIA comboboxes + + // aria-activedescendant defines a current item the value is computed from + testValue("aria_combobox1", kDiscBulletText + "Zoom"); + + // aria-selected defines a selected item the value is computed from, + // list control is pointed by aria-owns relation. + testValue("aria_combobox2", kDiscBulletText + "Zoom"); + + // aria-selected defines a selected item the value is computed from, + // list control is a child of combobox. + testValue("aria_combobox3", kDiscBulletText + "2"); + + // //////////////////////////////////////////////////////////////////////// + // HTML controls + testValue("combobox1", "item1"); + testValue("combobox2", "item2"); + + SimpleTest.finish(); + } + + SimpleTest.waitForExplicitFinish(); + addA11yLoadEvent(doTest); + </script> + +</head> + +<body> + + <a target="_blank" + href="https://bugzilla.mozilla.org/show_bug.cgi?id=494807" + title="Do not expose a11y info specific to hyperlinks when role is overridden using ARIA"> + Bug 494807 + </a> + <a target="_blank" + href="https://bugzilla.mozilla.org/show_bug.cgi?id=819273" + title="ARIA combobox should have accessible value"> + Bug 819273 + </a> + <a target="_blank" + href="https://bugzilla.mozilla.org/show_bug.cgi?id=887250" + title="ARIA textbox role doesn't expose value"> + Bug 887250 + </a> + <p id="display"></p> + <div id="content" style="display: none"> + </div> + <pre id="test"> + </pre> + + <a id="aria_menuitem_link" role="menuitem" href="foo">menuitem</a> + <a id="aria_button_link" role="button" href="foo">button</a> + <a id="aria_checkbox_link" role="checkbox" href="foo">checkbox</a> + + <!-- landmark links --> + <a id="aria_application_link" role="application" href="foo">app</a> + <a id="aria_main_link" role="main" href="foo">main</a> + <a id="aria_navigation_link" role="navigation" href="foo">nav</a> + + <!-- strange edge case: please don't do this in the wild --> + <a id="aria_link_link" role="link" href="foo">link</a> + + <div id="aria_textbox1" role="textbox">helo</div> + <div id="aria_textbox2" contenteditable role="textbox"> + <ol><li>test</li></ol> + </div> + + <div id="aria_combobox1" role="combobox" + aria-owns="aria_combobox1_owned_listbox" + aria-activedescendant="aria_combobox1_selected_option"> + </div> + <ul role="listbox" id="aria_combobox1_owned_listbox"> + <li role="option">Zebra</li> + <li role="option" id="aria_combobox1_selected_option">Zoom</li> + </ul> + + <div id="aria_combobox2" role="combobox" + aria-owns="aria_combobox2_owned_listbox"> + </div> + <ul role="listbox" id="aria_combobox2_owned_listbox"> + <li role="option">Zebra</li> + <li role="option" aria-selected="true">Zoom</li> + </ul> + + <div id="aria_combobox3" role="combobox"> + <div role="textbox"></div> + <ul role="listbox"> + <li role="option">1</li> + <li role="option" aria-selected="true">2</li> + <li role="option">3</li> + </ul> + </div> + + <select id="combobox1"> + <option id="cb1_item1">item1</option> + <option id="cb1_item2">item2</option> + </select> + <select id="combobox2"> + <option id="cb2_item1">item1</option> + <option id="cb2_item2" selected="true">item2</option> + </select> + +</body> +</html> diff --git a/accessible/tests/mochitest/value/test_number.html b/accessible/tests/mochitest/value/test_number.html new file mode 100644 index 0000000000..59024c3ef3 --- /dev/null +++ b/accessible/tests/mochitest/value/test_number.html @@ -0,0 +1,56 @@ +<html> + +<head> + <title>nsIAccessible value testing for input@type=range element</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="../value.js"></script> + + <script src="chrome://mochikit/content/chrome-harness.js"></script> + + <script type="application/javascript"> + function doTest() { + // HTML5 number element tests + testValue("number", "", 0, 0, 0, 1); + testValue("number_value", "1", 1, 0, 0, 1); + testValue("number_step", "", 0, 0, 0, 1); + testValue("number_min42", "", 0, 42, 0, 1); + testValue("number_max42", "", 0, 0, 42, 1); + + SimpleTest.finish(); + } + + SimpleTest.waitForExplicitFinish(); + addA11yLoadEvent(doTest); + </script> + +</head> + +<body> + + <a target="_blank" + href="https://bugzilla.mozilla.org/show_bug.cgi?id=559761" + title="make HTML5 input@type=number element accessible"> + Bug 559761 + </a> + <p id="display"></p> + <div id="content" style="display: none"> + </div> + <pre id="test"> + </pre> + + <!-- HTML5 input@type=number element --> + <input type="number" id="number"> + <input type="number" id="number_value" value="1"> + <input type="number" id="number_step" step="1"> + <input type="number" id="number_min42" min="42"> + <input type="number" id="number_max42" max="42"> +</body> +</html> diff --git a/accessible/tests/mochitest/value/test_progress.html b/accessible/tests/mochitest/value/test_progress.html new file mode 100644 index 0000000000..03ddb02196 --- /dev/null +++ b/accessible/tests/mochitest/value/test_progress.html @@ -0,0 +1,61 @@ +<html> + +<head> + <title>nsIAccessible value testing for progress element</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="../value.js"></script> + + <script src="chrome://mochikit/content/chrome-harness.js"></script> + + <script type="application/javascript"> + function doTest() { + // HTML5 progress element tests + testValue("pr_indeterminate", "", 0, 0, 1, 0); + testValue("pr_zero", "0%", 0, 0, 1, 0); + testValue("pr_zeropointfive", "50%", 0.5, 0, 1, 0); + testValue("pr_one", "100%", 1, 0, 1, 0); + testValue("pr_42", "100%", 42, 0, 1, 0); + testValue("pr_21", "50%", 21, 0, 42, 0); + testValue("pr_valuetext", "value", 0, 0, 1, 0); + + SimpleTest.finish(); + } + + SimpleTest.waitForExplicitFinish(); + addA11yLoadEvent(doTest); + </script> + +</head> + +<body> + + <a target="_blank" + href="https://bugzilla.mozilla.org/show_bug.cgi?id=559773" + title="make HTML5 progress element accessible"> + Mozilla Bug 559773 + </a><br /> + <p id="display"></p> + <div id="content" style="display: none"> + </div> + <pre id="test"> + </pre> + + <!-- HTML5 progress element --> + <progress id="pr_indeterminate">this will be read by legacy browsers</progress> + <progress id="pr_zero" value="0">this will be read by legacy browsers</progress> + <progress id="pr_zeropointfive" value="0.5">this will be read by legacy browsers</progress> + <progress id="pr_one" value="1">this will be read by legacy browsers</progress> + <progress id="pr_42" value="42">this will be read by legacy browsers</progress> + <progress id="pr_21" value="21" max="42">this will be read by legacy browsers</progress> + <!-- aria-valuetext should work due to implicit progressbar role (bug 1475376) --> + <progress id="pr_valuetext" aria-valuetext="value">this will be read by legacy browsers</progress> +</body> +</html> diff --git a/accessible/tests/mochitest/value/test_range.html b/accessible/tests/mochitest/value/test_range.html new file mode 100644 index 0000000000..55cb0b1767 --- /dev/null +++ b/accessible/tests/mochitest/value/test_range.html @@ -0,0 +1,59 @@ +<html> + +<head> + <title>nsIAccessible value testing for input@type=range element</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="../value.js"></script> + + <script src="chrome://mochikit/content/chrome-harness.js"></script> + + <script type="application/javascript"> + function doTest() { + // HTML5 progress element tests + testValue("range", "50", 50, 0, 100, 1); + testValue("range_value", "1", 1, 0, 100, 1); + testValue("range_step", "50", 50, 0, 100, 1); + testValue("range_min42", "71", 71, 42, 100, 1); + testValue("range_max42", "21", 21, 0, 42, 1); + testValue("range_valuetext", "value", 50, 0, 100, 1); + + SimpleTest.finish(); + } + + SimpleTest.waitForExplicitFinish(); + addA11yLoadEvent(doTest); + </script> + +</head> + +<body> + + <a target="_blank" + href="https://bugzilla.mozilla.org/show_bug.cgi?id=559764" + title="make HTML5 input@type=range element accessible"> + Bug 559764 + </a> + <p id="display"></p> + <div id="content" style="display: none"> + </div> + <pre id="test"> + </pre> + + <!-- HTML5 input@type=range element --> + <input type="range" id="range"> + <input type="range" id="range_value" value="1"> + <input type="range" id="range_step" step="1"> + <input type="range" id="range_min42" min="42"> + <input type="range" id="range_max42" max="42"> + <!-- aria-valuetext should work due to implicit slider role (bug 1475376) --> + <input type="range" id="range_valuetext" aria-valuetext="value"> +</body> +</html> |