blob: 6820c8fb4c24efef89c69215c562853c607dc86b [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../resources/js-test-pre.js"></script>
<script>
</script>
</head>
<body>
<form>
<select id="combo">
<option selected value='foo'>foo</option>
<option value='bar'>bar</option>
<option value='baz'>baz</option>
</select>
</form>
<p id="description"></p>
<div id="console"></div>
<script>
window.jsTestIsAsync = true;
description("This tests that a combo box notifies when the selected child has changed while arrowing through the options of a combobox while collapsed.");
var selectionChangedNotifications = 0;
if (window.testRunner && window.accessibilityController) {
testRunner.dumpAsText();
// Focus in the combobox and move around the options. The signal
// 'state-change:selected' should be emitted with every change.
document.getElementById("combo").focus();
axCombo = accessibilityController.focusedElement;
var eventTarget = accessibilityController.platformName == "atspi" ? axCombo.childAtIndex(0) : axCombo;
eventTarget.addNotificationListener(function (notification) {
if (notification == "AXSelectedChildrenChanged" || notification == "AXMenuItemSelected")
selectionChangedNotifications++;
});
eventSender.keyDown("downArrow");
eventSender.keyDown("downArrow");
eventSender.keyDown("upArrow");
eventSender.keyDown("upArrow");
window.setTimeout(function() {
if (window.accessibilityController)
eventTarget.removeNotificationListener();
// ATSPI sends one selection change notification per run loop iteration.
if (accessibilityController.platformName == "atspi")
shouldBe("selectionChangedNotifications", "1");
else
shouldBe("selectionChangedNotifications", "4");
finishJSTest();
}, 0);
}
</script>
<script src="../resources/js-test-post.js"></script>
</body>
</html>