| OLD | NEW |
| (Empty) | |
| 1 <!DOCTYPE html> |
| 2 <script src="../resources/testharness.js"></script> |
| 3 <script src="../resources/testharnessreport.js"></script> |
| 4 |
| 5 <div id="contenteditable-textbox" role="textbox" contenteditable="true" |
| 6 aria-expanded="true" aria-haspopup="true" aria-autocomplete="list" |
| 7 aria-activedescendant="list1-option1"> |
| 8 <ul id="list1" role="listbox"> |
| 9 <li id="list1-option1" role="option">Option 1</li> |
| 10 <li id="list1-option2" role="option">Option 2</li> |
| 11 <li id="list1-option3" role="option">Option 3</li> |
| 12 </ul> |
| 13 </div> |
| 14 |
| 15 <input id="input-textbox" role="textbox" type="text" aria-expanded="true" |
| 16 aria-haspopup="true" aria-autocomplete="list" |
| 17 aria-activedescendant="list2-option1" aria-owns="list2"> |
| 18 |
| 19 <ul id="list2" role="listbox"> |
| 20 <li id="list2-option1" role="option">Option 1</li> |
| 21 <li id="list2-option2" role="option">Option 2</li> |
| 22 <li id="list2-option3" role="option">Option 3</li> |
| 23 </ul> |
| 24 |
| 25 <input id="input-combobox" role="combobox" type="search" aria-expanded="true" |
| 26 aria-haspopup="true" aria-autocomplete="list" |
| 27 aria-activedescendant="list3-option1" aria-owns="list3"> |
| 28 |
| 29 <ul id="list3" role="listbox"> |
| 30 <li id="list3-option1" role="option">Option 1</li> |
| 31 <li id="list3-option2" role="option">Option 2</li> |
| 32 <li id="list3-option3" role="option">Option 3</li> |
| 33 </ul> |
| 34 |
| 35 <textarea id="textarea-searchbox" role="searchbox" aria-expanded="true" |
| 36 aria-haspopup="true" aria-autocomplete="list" |
| 37 aria-activedescendant="list4-option1" aria-owns="list4"></textarea> |
| 38 |
| 39 <ul id="list4" role="listbox"> |
| 40 <li id="list4-option1" role="option">Option 1</li> |
| 41 <li id="list4-option2" role="option">Option 2</li> |
| 42 <li id="list4-option3" role="option">Option 3</li> |
| 43 </ul> |
| 44 |
| 45 <script> |
| 46 function testEventExpectations(t, widgetId, listboxId) |
| 47 { |
| 48 var listbox = document.getElementById(listboxId); |
| 49 var widget = document.getElementById(widgetId); |
| 50 var axWidget = accessibilityController.accessibleElementById(widgetId); |
| 51 var focusChangedEventCount = 0; |
| 52 var activeDescendantChangedEventCount = 0; |
| 53 axWidget.addNotificationListener(function(notification) |
| 54 { |
| 55 if (notification == "Focus") |
| 56 ++focusChangedEventCount; |
| 57 if (notification == "ActiveDescendantChanged") |
| 58 ++activeDescendantChangedEventCount; |
| 59 if (focusChangedEventCount == 1 && activeDescendantChangedEventCount
== 3) { |
| 60 widget.style.display = "none"; |
| 61 listbox.style.display = "none"; |
| 62 t.done(); |
| 63 } |
| 64 }); |
| 65 |
| 66 widget.focus(); |
| 67 widget.setAttribute("aria-activedescendant", listboxId + "-option2"); |
| 68 widget.setAttribute("aria-activedescendant", listboxId + "-option3"); |
| 69 widget.removeAttribute("aria-activedescendant"); |
| 70 } |
| 71 </script> |
| 72 |
| 73 <script> |
| 74 async_test(function(t) |
| 75 { |
| 76 testEventExpectations(t, "contenteditable-textbox", "list1"); |
| 77 }, "Changing active descendant on a content editable."); |
| 78 </script> |
| 79 |
| 80 <script> |
| 81 async_test(function(t) |
| 82 { |
| 83 testEventExpectations(t, "input-textbox", "list2"); |
| 84 }, "Changing active descendant on an input with role=textbox."); |
| 85 </script> |
| 86 |
| 87 <script> |
| 88 async_test(function(t) |
| 89 { |
| 90 testEventExpectations(t, "input-combobox", "list3"); |
| 91 }, "Changing active descendant on an input of type=search with role=combobox
."); |
| 92 </script> |
| 93 |
| 94 <script> |
| 95 async_test(function(t) |
| 96 { |
| 97 testEventExpectations(t, "textarea-searchbox", "list4"); |
| 98 }, "Changing active descendant on a textarea with role=searchbox."); |
| 99 </script> |
| OLD | NEW |