| OLD | NEW |
| (Empty) | |
| 1 <!DOCTYPE html> |
| 2 <script src="../resources/testharness.js"></script> |
| 3 <script src="../resources/testharnessreport.js"></script> |
| 4 |
| 5 <div id="main" role="main"> |
| 6 |
| 7 <div id="contenteditable-textbox" role="textbox" contenteditable="true" |
| 8 aria-expanded="true" aria-haspopup="true" aria-autocomplete="list" |
| 9 aria-activedescendant="option1"> |
| 10 </div> |
| 11 |
| 12 <input id="input-textbox" role="textbox" type="text" aria-expanded="true" |
| 13 aria-haspopup="true" aria-autocomplete="list" |
| 14 aria-activedescendant="option1"> |
| 15 |
| 16 <input id="input-combobox" role="combobox" type="search" aria-expanded="true
" |
| 17 aria-haspopup="true" aria-autocomplete="list" |
| 18 aria-activedescendant="option1"> |
| 19 |
| 20 <textarea id="textarea-searchbox" role="searchbox" aria-expanded="true" |
| 21 aria-haspopup="true" aria-autocomplete="list" |
| 22 aria-activedescendant="option1"></textarea> |
| 23 |
| 24 <ul id="listbox" role="listbox" style="display: none;"> |
| 25 <li id="option1" role="option">Option 1</li> |
| 26 <li id="option2" role="option">Option 2</li> |
| 27 <li id="option3" role="option">Option 3</li> |
| 28 </ul> |
| 29 |
| 30 </div> |
| 31 |
| 32 <script> |
| 33 function testExpectations(elementId) |
| 34 { |
| 35 var listbox = document.getElementById("listbox"); |
| 36 listbox.style.display = "block"; |
| 37 var textField = document.getElementById(elementId); |
| 38 textField.setAttribute("aria-owns", "listbox"); |
| 39 textField.focus(); |
| 40 |
| 41 var axTextField = accessibilityController.accessibleElementById(elementI
d); |
| 42 var axListbox = accessibilityController.accessibleElementById("listbox")
; |
| 43 var option1 = accessibilityController.accessibleElementById("option1"); |
| 44 var option2 = accessibilityController.accessibleElementById("option2"); |
| 45 var option3 = accessibilityController.accessibleElementById("option3"); |
| 46 |
| 47 assert_true(axTextField.isExpanded, "axTextField.isExpanded"); |
| 48 assert_true(axTextField.hasPopup, "axTextField.hasPopup"); |
| 49 // According to the ARIA Spec, the presence of aria-activedescendant |
| 50 // should make all children with a valid ID focusable. |
| 51 assert_true(axListbox.isFocusable, "axListbox.isFocusable"); |
| 52 assert_true(option1.isFocusable, "option1.isFocusable"); |
| 53 assert_true(option1.isSelectable, "option1.isSelectable"); |
| 54 assert_true(option2.isFocusable, "option2.isFocusable"); |
| 55 assert_true(option2.isSelectable, "option2.isSelectable"); |
| 56 assert_true(option3.isFocusable, "option3.isFocusable"); |
| 57 assert_true(option3.isSelectable, "option3.isSelectable"); |
| 58 |
| 59 assert_true(option1.isFocused, "option1.isFocused"); |
| 60 assert_true(option1.isSelected, "option1.isSelected"); |
| 61 |
| 62 textField.setAttribute("aria-activedescendant", "option2"); |
| 63 assert_false(option1.isFocused, "option1.isFocused"); |
| 64 assert_false(option1.isSelected, "option1.isSelected"); |
| 65 assert_true(option2.isFocused, "option2.isFocused"); |
| 66 assert_true(option2.isSelected, "option2.isSelected"); |
| 67 |
| 68 textField.setAttribute("aria-activedescendant", "option3"); |
| 69 assert_false(option2.isFocused, "option2.isFocused"); |
| 70 assert_false(option2.isSelected, "option2.isSelected"); |
| 71 assert_true(option3.isFocused, "option3.isFocused"); |
| 72 assert_true(option3.isSelected, "option3.isSelected"); |
| 73 |
| 74 textField.removeAttribute("aria-activedescendant"); |
| 75 assert_false(option3.isFocused, "option3.isFocused"); |
| 76 assert_false(option3.isSelected, "option3.isSelected"); |
| 77 assert_true(axTextField.isFocused, "axTextField.isFocused"); |
| 78 |
| 79 textField.removeAttribute("aria-owns"); |
| 80 listbox.style.display = "none"; |
| 81 } |
| 82 </script> |
| 83 |
| 84 <script> |
| 85 test(function() |
| 86 { |
| 87 testExpectations("contenteditable-textbox"); |
| 88 }, "Changing active descendant on a content editable."); |
| 89 </script> |
| 90 |
| 91 <script> |
| 92 test(function() |
| 93 { |
| 94 testExpectations("input-textbox"); |
| 95 }, "Changing active descendant on an input with role=textbox."); |
| 96 </script> |
| 97 |
| 98 <script> |
| 99 test(function() |
| 100 { |
| 101 testExpectations("input-combobox"); |
| 102 }, "Changing active descendant on an input of type=search with role=combobox
."); |
| 103 </script> |
| 104 |
| 105 <script> |
| 106 test(function() |
| 107 { |
| 108 testExpectations("textarea-searchbox"); |
| 109 }, "Changing active descendant on a textarea with role=searchbox."); |
| 110 </script> |
| 111 |
| 112 <script> |
| 113 if (window.testRunner) |
| 114 document.getElementById("main").style.display = "none"; |
| 115 </script> |
| OLD | NEW |