| <!DOCTYPE HTML> |
| <script src="../resources/testharness.js"></script> |
| <script src="../resources/testharnessreport.js"></script> |
| <select id="listbox" size="3"> |
| <option id="item0">Alicia</option> |
| <option id="item1">Peter</option> |
| <option id="item2">Kalinda</option> |
| <option id="item3" disabled>Frank</option> |
| </select> |
| <script> |
| async_test(function(t) |
| { |
| var listbox = document.getElementById("listbox"); |
| listbox.selectedIndex = 0; |
| listbox.focus(); |
| |
| accessibilityController.accessibleElementById('dummy'); |
| |
| var gotCheckedStateChanged = false; |
| var gotSelectedChildrenChanged = false; |
| |
| window.setTimeout(function() { |
| var result = ""; |
| accessibilityController.addNotificationListener(t.step_func(function listener(element, notification) { |
| if (notification == "CheckedStateChanged") { |
| assert_equals(element.role, "AXRole: AXListBoxOption"); |
| gotCheckedStateChanged = true; |
| } |
| if (notification == "SelectedChildrenChanged") { |
| assert_equals(element.role, "AXRole: AXListBox"); |
| gotSelectedChildrenChanged = true; |
| } |
| if (gotCheckedStateChanged && gotSelectedChildrenChanged) { |
| t.done(); |
| } |
| })); |
| |
| listbox.selectedIndex = 1; |
| }, 0); |
| }, "menu list fires correct events when active index changes."); |
| |
| function axElementById(id) { |
| return accessibilityController.accessibleElementById(id); |
| } |
| |
| test(function(t) { |
| var axOption = axElementById("item2"); |
| assert_equals(axOption.isFocusable, true); |
| }, "Listbox option is focusable"); |
| |
| test(function(t) { |
| var axOption = axElementById("item3"); |
| assert_equals(axOption.isFocusable, false); |
| }, "Disabled listbox option is not focusable"); |
| </script> |