blob: 04bb9a003476cd4ae588107dfdb56b4c64ac3b2f [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../../fast/js/resources/js-test-pre.js"></script>
</head>
<body id="body">
<select name="suite" id="suite" multiple="multiple" size="24">
<optgroup label="main">
<option value="881">Item1</option>
<option value="938">Item2</option>
</optgroup>
<optgroup label="primary">
<option value="1027">Item3</option>
<option value="1049">Item4</option>
<option value="1050">Item5</option>
</optgroup>
</select>
<p id="description"></p>
<div id="console"></div>
<script>
description("This tests that setting selection within a list box works correctly if there are optgroups");
if (window.accessibilityController) {
document.getElementById("suite").focus();
var selectElement = accessibilityController.focusedElement;
shouldBe("selectElement.selectedChildrenCount", "0");
var option1 = selectElement.childAtIndex(1);
var option2 = selectElement.childAtIndex(2);
var option3 = selectElement.childAtIndex(4);
selectElement.setSelectedChild(option1);
shouldBe("selectElement.selectedChildrenCount", "1");
shouldBeTrue("selectElement.selectedChildAtIndex(0).isEqual(option1)");
selectElement.setSelectedChild(option2);
shouldBe("selectElement.selectedChildrenCount", "1");
shouldBeTrue("selectElement.selectedChildAtIndex(0).isEqual(option2)");
selectElement.setSelectedChild(option3);
shouldBe("selectElement.selectedChildrenCount", "1");
shouldBeTrue("selectElement.selectedChildAtIndex(0).isEqual(option3)");
}
</script>
<script src="../../../fast/js/resources/js-test-post.js"></script>
</body>
</html>