зеркало из https://github.com/mozilla/pjs.git
bug 477975 - Expose action on HTML5 indeterminate checkboxes, r=davidb
--HG-- rename : accessible/tests/mochitest/test_nsIAccessible_actions.xul => accessible/tests/mochitest/test_actions.xul rename : accessible/tests/mochitest/test_nsIAccessible_actions.html => accessible/tests/mochitest/test_actions_aria.html
This commit is contained in:
Родитель
cf90dd5fd8
Коммит
9d46e716d5
|
@ -2308,7 +2308,9 @@ nsAccessible::GetActionName(PRUint8 aIndex, nsAString& aName)
|
|||
return NS_OK;
|
||||
|
||||
case eCheckUncheckAction:
|
||||
if (states & nsIAccessibleStates::STATE_CHECKED)
|
||||
if (states & nsIAccessibleStates::STATE_MIXED)
|
||||
aName.AssignLiteral("cycle");
|
||||
else if (states & nsIAccessibleStates::STATE_CHECKED)
|
||||
aName.AssignLiteral("uncheck");
|
||||
else
|
||||
aName.AssignLiteral("check");
|
||||
|
|
|
@ -81,13 +81,15 @@ NS_IMETHODIMP nsHTMLCheckboxAccessible::GetNumActions(PRUint8 *_retval)
|
|||
NS_IMETHODIMP nsHTMLCheckboxAccessible::GetActionName(PRUint8 aIndex, nsAString& aName)
|
||||
{
|
||||
if (aIndex == eAction_Click) { // 0 is the magic value for default action
|
||||
// check or uncheck
|
||||
// cycle, check or uncheck
|
||||
PRUint32 state;
|
||||
nsresult rv = GetStateInternal(&state, nsnull);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (state & nsIAccessibleStates::STATE_CHECKED)
|
||||
aName.AssignLiteral("uncheck");
|
||||
else if (state & nsIAccessibleStates::STATE_MIXED)
|
||||
aName.AssignLiteral("cycle");
|
||||
else
|
||||
aName.AssignLiteral("check");
|
||||
|
||||
|
|
|
@ -62,6 +62,9 @@ _TEST_FILES =\
|
|||
nsIAccessibleEditableText.js \
|
||||
relations.js \
|
||||
role.js \
|
||||
test_actions_aria.html \
|
||||
test_actions_inputs.html \
|
||||
test_actions.xul \
|
||||
test_aria_activedescendant.html \
|
||||
test_aria_role_article.html \
|
||||
test_aria_role_equation.html \
|
||||
|
@ -76,10 +79,8 @@ _TEST_FILES =\
|
|||
test_groupattrs.html \
|
||||
test_name_markup.html \
|
||||
$(warning test_table_indexes.html temporarily disabled) \
|
||||
test_nsIAccessible_actions.html \
|
||||
$(warning test_nsIAccessible_actions.xul temporarily disabled) \
|
||||
test_nsIAccessible_applicationAccessible.html \
|
||||
test_nsIAccessible_comboboxes.xul \
|
||||
$(warning test_nsIAccessible_comboboxes.xul temporarily disabled) \
|
||||
test_nsIAccessible_name.html \
|
||||
test_nsIAccessible_name_button.html \
|
||||
test_nsIAccessible_name_link.html \
|
||||
|
|
|
@ -40,6 +40,11 @@
|
|||
actionName: "uncheck",
|
||||
events: CLICK_EVENTS
|
||||
},
|
||||
{
|
||||
ID: "checkbox_mixed",
|
||||
actionName: "cycle",
|
||||
events: CLICK_EVENTS
|
||||
},
|
||||
{
|
||||
ID: "combobox_collapsed",
|
||||
actionName: "open",
|
||||
|
@ -118,11 +123,13 @@
|
|||
|
||||
<div id="clickable" onclick="">Clickable text</div>
|
||||
|
||||
<div id="button" role="button">Button</span>
|
||||
<div id="button" role="button">Button</div>
|
||||
|
||||
<div id="checkbox_unchecked" role="checkbox">Checkbox</span>
|
||||
<div id="checkbox_unchecked" role="checkbox">Checkbox</div>
|
||||
|
||||
<div id="checkbox_checked" role="checkbox" aria-checked="true">Checkbox</span>
|
||||
<div id="checkbox_checked" role="checkbox" aria-checked="true">Checkbox</div>
|
||||
|
||||
<div id="checkbox_mixed" role="checkbox" aria-checked="mixed">Checkbox</div>
|
||||
|
||||
<div id="combobox_collapsed" role="combobox">
|
||||
<div id="option" role="option">Option of collapsed combobox</div>
|
|
@ -0,0 +1,83 @@
|
|||
<html>
|
||||
|
||||
<head>
|
||||
<title>nsIAccessible actions testing for inputs</title>
|
||||
|
||||
<link rel="stylesheet" type="text/css"
|
||||
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
|
||||
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/a11y/accessible/common.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/a11y/accessible/nsIAccessible_actions.js"></script>
|
||||
|
||||
<script type="application/javascript">
|
||||
function doTest()
|
||||
{
|
||||
var actionsArray = [
|
||||
{
|
||||
ID: "button",
|
||||
actionName: "press",
|
||||
events: CLICK_EVENTS
|
||||
},
|
||||
{
|
||||
ID: "checkbox_unchecked",
|
||||
actionName: "check",
|
||||
events: CLICK_EVENTS
|
||||
},
|
||||
{
|
||||
ID: "checkbox_checked",
|
||||
actionName: "uncheck",
|
||||
events: CLICK_EVENTS
|
||||
},
|
||||
{
|
||||
ID: "checkbox_mixed",
|
||||
actionName: "cycle",
|
||||
events: CLICK_EVENTS
|
||||
},
|
||||
{
|
||||
ID: "radio",
|
||||
actionName: "select",
|
||||
events: CLICK_EVENTS
|
||||
}
|
||||
];
|
||||
document.getElementById("checkbox_mixed").indeterminate = true;
|
||||
|
||||
testActions(actionsArray);
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
addLoadEvent(doTest);
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<a target="_blank"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=477975"
|
||||
title="nsIAccessible actions testing">
|
||||
Mozilla Bug 477975
|
||||
</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none"></div>
|
||||
<pre id="test">
|
||||
</pre>
|
||||
|
||||
<button id="button" value="button">Button</button>
|
||||
|
||||
<input id="checkbox_unchecked" type="checkbox">Checkbox</input>
|
||||
|
||||
<input id="checkbox_checked" type="checkbox" checked="true">Checkbox</input>
|
||||
|
||||
<input id="checkbox_mixed" type="checkbox">Checkbox</input>
|
||||
|
||||
<fieldset>
|
||||
<input id="radio" type="radio">Radio</input>
|
||||
</fieldset>
|
||||
</body>
|
||||
</html>
|
Загрузка…
Ссылка в новой задаче