blob: dc7b832dcd1444d9342ba837dd943225eb61f42d [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../resources/js-test.js"></script>
<script src="../resources/accessibility-helper.js"></script>
</head>
<body id="body">
<fieldset>
<legend>Choose a shipping method:</legend>
<input id="overnight" type="radio" name="shipping" value="overnight" />Overnight
</fieldset>
<div>End of test</div>
<p id="description"></p>
<div id="console"></div>
<script>
description("This tests that a fieldset's title ui element is the legend.");
if (window.accessibilityController) {
document.body.focus();
var body = accessibilityController.focusedElement;
var fieldset = body.childAtIndex(0);
var titleUIElement = fieldset.nameElementAtIndex(0);
// Print out the tree of accessible objects, indicating the titleUIElement so
// that each platform can verify their expected object has been found
buildAccessibilityTree(body, 0, 0, 0, titleUIElement, "<< fieldset's titleUIElement");
// Verify that we have gotten the titleUIElement and it has the expected text,
// which should be in the last descendant regardless of platform.
shouldBeTrue("titleUIElement != null");
var titleUIElementText = titleUIElement;
while (titleUIElementText && titleUIElementText.childrenCount)
titleUIElementText = titleUIElementText.childAtIndex(0);
shouldBe("titleUIElementText.name", "'Choose a shipping method:'");
}
</script>
</body>
</html>