gecko/accessible/tests/mochitest/test_textboxes.html
Alexander Surkov aa6ce2d7de Bug 733382 - editable state bit should be presented on readonly inputs, r=davidb
--HG--
rename : accessible/tests/mochitest/states/test_inputs.xul => accessible/tests/mochitest/states/test_controls.xul
2012-03-14 13:48:01 -04:00

165 lines
6.7 KiB
HTML

<!DOCTYPE html>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=442648
-->
<head>
<title>nsIAccessible textboxes chrome tests</title>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript"
src="common.js"></script>
<script type="application/javascript"
src="role.js"></script>
<script type="application/javascript"
src="states.js"></script>
<script type="application/javascript"
src="testTextboxes.js"></script>
<script type="application/javascript">
function doTest()
{
//////////////////////////////////////////////////////////////////////////
// normal textbox without content and with no proper label
testThis("unlabelled_Textbox", // ID
null, // name
"", // value
"", // description
ROLE_ENTRY, // role
1, // numActions
"activate", // ActionName
"Activate"); // ActionDescription
//////////////////////////////////////////////////////////////////////////
// normal textbox without content and with a proper label
testThis("labelled_textbox", // ID
"Second textbox:", // name
"", // value
"", // description
ROLE_ENTRY, // role
1, // numActions
"activate", // ActionName
"Activate"); // ActionDescription
//////////////////////////////////////////////////////////////////////////
// normal textbox with content and with a proper label
testThis("prefilled_textbox", // ID
"Textbox with predefined value:", // name
"I have some text", // value
"", // description
ROLE_ENTRY, // role
1, // numActions
"activate", // ActionName
"Activate"); // ActionDescription
//////////////////////////////////////////////////////////////////////////
// password textbox with a proper label
testThis("password_textbox", // ID
"Enter some password here:", // name
"", // value
"", // description
ROLE_PASSWORD_TEXT, // role
1, // numActions
"activate", // ActionName
"Activate"); // ActionDescription
//////////////////////////////////////////////////////////////////////////
// textarea without content and label
testThis("unlabelled_Textarea", // ID
null, // name
"", // value
"", // description
ROLE_ENTRY, // role
1, // numActions
"activate", // ActionName
"Activate"); // ActionDescription
//////////////////////////////////////////////////////////////////////////
// textarea without content and with proper label
testThis("labelled_textarea", // ID
"Labelled textarea:", // name
"", // value
"", // description
ROLE_ENTRY, // role
1, // numActions
"activate", // ActionName
"Activate"); // ActionDescription
//////////////////////////////////////////////////////////////////////////
// textarea with content and with proper label
testThis("prefilled_textarea", // ID
"Pre-filled textarea:", // name
" I also have some text.\n ", // value
"", // description
ROLE_ENTRY, // role
1, // numActions
"activate", // ActionName
"Activate"); // ActionDescription
//////////////////////////////////////////////////////////////////////////
// readonly textbox with content and with proper label
testThis("readonly_textbox", // ID
"The following is a read-only textbox:", // name
"You cannot change me.", // value
"", // description
ROLE_ENTRY, // role
1, // numActions
"activate", // ActionName
"Activate"); // ActionDescription
//////////////////////////////////////////////////////////////////////////
// readonly textarea with content and with proper label
testThis("readonly_textarea", // ID
"This textarea is readonly, too:", // name
" You cannot change me, either.\n ", // value
"", // description
ROLE_ENTRY, // role
1, // numActions
"activate", // ActionName
"Activate"); // ActionDescription
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addA11yLoadEvent(doTest);
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=442648">Mozilla Bug 442648</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
</pre>
<form action="test.php" method="post">
Text before input without labelling it:
<input type="text" name="unlabelled_Textbox" id="unlabelled_Textbox" size="50"/>
<br><label for="labelled_textbox">Second textbox:</label>
<input type="text" name="labelled_Textbox" id="labelled_textbox"/>
<br><label for="prefilled_textbox">Textbox with predefined value:</label>
<input type="text" name="prefilled_Textbox" id="prefilled_textbox" value="I have some text" size="80"/>
<br><label for="password_textbox">Enter some password here:</label>
<input type="password" name="password_Textbox" id="password_textbox"/>
<br>Textarea without label:<br>
<textarea id="unlabelled_Textarea" name="unlabelled_Textarea" cols="80" rows="5"></textarea>
<br><label for="labelled_textarea">Labelled textarea:</label><br>
<textarea id="labelled_textarea" name="labelled_Textarea" cols="80" rows="5"></textarea>
<br><label for="prefilled_textarea">Pre-filled textarea:</label><br>
<textarea id="prefilled_textarea" name="prefilled_Textarea" cols="80" rows="5">
I also have some text.
</textarea>
<br><label for="readonly_textbox">The following is a read-only textbox:</label>
<input type="text" readonly="true" name="readonly_Textbox" id="readonly_textbox" value="You cannot change me."/>
<br><label for="readonly_textarea">This textarea is readonly, too:</label><br>
<textarea name="readonly_Textarea" id="readonly_textarea" readonly="true" cols="80" rows="5">
You cannot change me, either.
</textarea>
</form>
</body>
</html>