diff options
Diffstat (limited to 'accessible/tests/mochitest/value')
-rw-r--r-- | accessible/tests/mochitest/value/a11y.ini | 11 | ||||
-rw-r--r-- | accessible/tests/mochitest/value/test_ariavalue.html | 85 | ||||
-rw-r--r-- | accessible/tests/mochitest/value/test_datetime.html | 76 | ||||
-rw-r--r-- | accessible/tests/mochitest/value/test_general.html | 159 | ||||
-rw-r--r-- | accessible/tests/mochitest/value/test_meter.html | 82 | ||||
-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 |
8 files changed, 589 insertions, 0 deletions
diff --git a/accessible/tests/mochitest/value/a11y.ini b/accessible/tests/mochitest/value/a11y.ini new file mode 100644 index 0000000000..8bd39474a8 --- /dev/null +++ b/accessible/tests/mochitest/value/a11y.ini @@ -0,0 +1,11 @@ +[DEFAULT] +support-files = + !/accessible/tests/mochitest/*.js + +[test_ariavalue.html] +[test_datetime.html] +[test_general.html] +[test_number.html] +[test_progress.html] +[test_range.html] +[test_meter.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..bdb62a866d --- /dev/null +++ b/accessible/tests/mochitest/value/test_ariavalue.html @@ -0,0 +1,85 @@ +<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); + } + + testValue("spinbutton_default", "", 0, 0, 0, 0); + testValue("spinbutton_min1max50", "", 0, 1, 50, 0); + testValue("spinbutton_max200", "", 0, 0, 200, 0); + testValue("spinbutton_min10", "", 0, 10, 0, 0); + testValue("spinbutton_vt", "juice", 0, 0, 0, 0); + testValue("spinbutton_vn", "6", 6, 0, 0, 0); + testValue("spinbutton_vtvn", "juice", 6, 0, 0, 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> + + <!-- ARIA spinbuttons --> + <div id="spinbutton_default" role="spinbutton">vanilla spinbutton</div> + <div id="spinbutton_min1max50" role="spinbutton" aria-valuemin="1" aria-valuemax="50">banana spinbutton</div> + <div id="spinbutton_max200" role="spinbutton" aria-valuemax="200">cherry spinbutton</div> + <div id="spinbutton_min10" role="spinbutton" aria-valuemin="10">strawberry spinbutton</div> + <div id="spinbutton_vt" role="spinbutton" aria-valuetext="juice">orange spinbutton</div> + <div id="spinbutton_vn" role="spinbutton" aria-valuenow="6">chocolate spinbutton</div> + <div id="spinbutton_vtvn" role="spinbutton" aria-valuetext="juice" aria-valuenow="6">apple spinbutton</div> +</body> + +</html> diff --git a/accessible/tests/mochitest/value/test_datetime.html b/accessible/tests/mochitest/value/test_datetime.html new file mode 100644 index 0000000000..e03356ac1a --- /dev/null +++ b/accessible/tests/mochitest/value/test_datetime.html @@ -0,0 +1,76 @@ +<!doctype html> +<html> +<head> + <title>nsIAccessible value testing for datetime-local input element</title> + <link rel="stylesheet" + href="chrome://mochikit/content/tests/SimpleTest/test.css" /> + + <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> + + <script src="../common.js"></script> + <script src="../promisified-events.js"></script> + + <script> + async function doTest() { + const dateTimeNode = getNode("datetime"); + const dateTime = getAccessible(dateTimeNode); + // We assume en-US for testing. However, the OS date format might + // override the en-US date format. + const monthFirst = dateTime.getChildAt(0).name == "Month"; + const month = dateTime.getChildAt(monthFirst ? 0 : 2); + const day = dateTime.getChildAt(monthFirst ? 2 : 0); + const year = dateTime.getChildAt(4); + const hour = dateTime.getChildAt(6); + const minute = dateTime.getChildAt(8); + const amPm = dateTime.getChildAt(10); + + // We don't use testValue() because it also checks numeric value, but + // we don't support numeric value here because it isn't useful. + function assertIsClear() { + is(year.value, ""); + is(month.value, ""); + is(day.value, ""); + is(hour.value, ""); + is(minute.value, ""); + // Unlike the numeric fields, amPm is a textbox. Since textboxes take + // their a11y value from their text content and "--" is set as the text + // content, the a11y value is "--". + is(amPm.value, "--"); + } + + info("Checking that input is initially clear"); + assertIsClear(); + + // The container doesn't notify of value changes, so we wait for a value + // change on one of the fields to know when it's updated. + info("Setting value"); + let changed = waitForEvent(EVENT_TEXT_VALUE_CHANGE, month); + dateTimeNode.value = "2000-01-02T03:04"; + await changed; + is(year.value, "2000"); + is(month.value, "01"); + is(day.value, "02"); + is(hour.value, "03"); + is(minute.value, "04"); + // Again, the OS date format might override, so we might get "am" instead + // of "AM". + is(amPm.value.toLowerCase(), "am"); + + info("Clearing value"); + changed = waitForEvent(EVENT_TEXT_VALUE_CHANGE, month); + dateTimeNode.value = ""; + await changed; + assertIsClear(); + + SimpleTest.finish(); + } + + SimpleTest.waitForExplicitFinish(); + addA11yLoadEvent(doTest); + </script> +</head> + +<body> + <input type="datetime-local" id="datetime"> +</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_meter.html b/accessible/tests/mochitest/value/test_meter.html new file mode 100644 index 0000000000..7ae1ed3543 --- /dev/null +++ b/accessible/tests/mochitest/value/test_meter.html @@ -0,0 +1,82 @@ +<html> + +<head> + <title>nsIAccessible value testing for meter 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 meter element tests + testValue("nothing", "0", 0, 0, 1, 0); + testValue("minOnly", "20", 20, 20, 20, 0); + testValue("maxOnly", "0", 0, 0, 20, 0); + testValue("valOnly", "1", 1, 0, 1, 0); + testValue("regular", "15", 15, 10, 30, 0); + testValue("noMin", "10", 10, 0, 100, 0); + testValue("noMax", "5", 5, 5, 5, 0); + testValue("noVal", "10", 10, 10, 20, 0); + testValue("invalidValue", "20", 20, 10, 20, 0); + testValue("invalidMax", "10", 10, 10, 10, 0); + testValue("invalidValueMax", "20", 20, 20, 20, 0); + + testValue("plainText", "Hello world", 0, 0, 1, 0); + testValue("regularText", "You scored 15 out of 30", 15, 10, 30, 0); + testValue("invalidText", "Something isnt right here", 20, 20, 20, 0); + + testValue("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=1460378" + title="HTML <meter> not spoken by screen readers"> + Mozilla Bug 559773 + </a><br /> + <p id="display"></p> + <div id="content" style="display: none"> + </div> + <pre id="test"> + </pre> + + <meter id="nothing"></meter> + + <meter id="minOnly" min="20"></meter> + <meter id="maxOnly" max="20"></meter> + <meter id="valOnly" value="20"></meter> + + <meter id="regular" min="10" value="15" max="30"></meter> + + <meter id="noMin" value="10" max="100"></meter> + <meter id="noMax" min="5" value="10"></meter> + <meter id="noVal" min="10" max="20"></meter> + + <meter id="invalidValue" min="10" value="30" max="20"></meter> + <meter id="invalidMax" min="10" value="15" max="2"></meter> + <meter id="invalidValueMax" min="20" value="17" max="10"></meter> + + <meter id="plainText">Hello world</meter> + <meter id="regularText" min="10" value="15" max="30">You scored 15 out of 30</meter> + <meter id="invalidText" min="20" value="17" max="10">Something isnt right here</meter> + + <meter id="valueText" aria-valuetext="value">valuetext should take precedence over internal text</meter> +</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> |