blob: d54c7bad6b53d13681fa936ee0a260c199bdafb6 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../resources/js-test-pre.js"></script>
<script src="../resources/accessibility-helper.js"></script>
<title>Fieldset Element</title>
</head>
<body>
<div id="content">
<form>
<!-- fieldset with aria-label. -->
<fieldset aria-label="High Score:" class="fieldsetTest" id="f0">
Name: <input type="text">
</fieldset>
</form>
<form>
<!-- fieldset and legend. -->
<fieldset class="fieldsetTest" id="f1">
<legend>High Score:</legend>
Name: <input type="text">
</fieldset>
</form>
<form>
<!-- fieldset with aria-label and legend. -->
<fieldset aria-label="New High Score:" class="fieldsetTest" id="f2">
<legend>High Score:</legend>
Name: <input type="text">
</fieldset>
</form>
<form>
<!-- fieldset and legend with aria-label. -->
<fieldset class="fieldsetTest" id="f3">
<legend aria-label="New High Score:">High Score:</legend>
Name: <input type="text">
</fieldset>
</form>
<form>
<!-- fieldset and hidden legend. -->
<fieldset class="fieldsetTest" id="f4">
<legend aria-hidden="true">High Score:</legend>
Name: <input type="text">
</fieldset>
</form>
<form>
<!-- fieldset and offscreen legend. -->
<fieldset class="fieldsetTest" id="f5">
<legend style="left:-9999px; position:absolute;">High Score:</legend>
Name: <input type="text">
</fieldset>
</form>
<form>
<!-- fieldset and unrendered legend. -->
<fieldset class="fieldsetTest" id="f6">
<legend style="display:none;">High Score:</legend>
Name: <input type="text">
</fieldset>
</form>
<!-- legend outside fieldset. -->
<legend id="l0">Other:</legend>
</div>
<p id="description"></p>
<div id="console"></div>
<script>
description("This tests that fieldset and legend elements are exposed correctly.");
if (window.accessibilityController) {
var fieldsetDescription = 0;
var fieldsetTestCount = 0;
var legendValue = 0;
// fieldset tests.
fieldsetTestCount = document.getElementsByClassName("fieldsetTest").length;
for (var i = 0; i < fieldsetTestCount; ++i) {
var accName = platformValueForW3CName(accessibilityController.accessibleElementById("f" + i));
debug("element id 'f" + i + "': " + accName);
}
// legend tests.
var legend = accessibilityController.accessibleElementById("l0");
if (legend.childrenCount)
legend = legend.childAtIndex(0);
debug("element id 'l0': " + legend.stringValue);
document.getElementById("content").style.visibility = "hidden";
}
</script>
<script src="../resources/js-test-post.js"></script>
</body>
</html>