| OLD | NEW |
| 1 <!DOCTYPE HTML> | 1 <!DOCTYPE HTML> |
| 2 <html> | 2 <html> |
| 3 <body> | 3 <body> |
| 4 <script src="../resources/js-test.js"></script> | 4 <script src="../resources/js-test.js"></script> |
| 5 | 5 |
| 6 <select id="menulist"> | 6 <select id="menulist"> |
| 7 <option id="item0">Alicia</option> | 7 <option id="item0">Alicia</option> |
| 8 <option id="item1">Peter</option> | 8 <option id="item1">Peter</option> |
| 9 <option id="item2">Kalinda</option> | 9 <option id="item2">Kalinda</option> |
| 10 </select> | 10 </select> |
| 11 | 11 |
| 12 <div id="console"></div> | 12 <div id="console"></div> |
| 13 <script> | 13 <script> |
| 14 description("This test makes sure menu lists fire events on both the option that
lost selection and the one that gained selection."); | 14 description("This test makes sure menu lists fire events on both the option that
lost selection and the one that gained selection."); |
| 15 window.jsTestIsAsync = true; | 15 window.jsTestIsAsync = true; |
| 16 | 16 |
| 17 if (window.testRunner && window.accessibilityController) { | 17 if (window.testRunner && window.accessibilityController) { |
| 18 window.testRunner.dumpAsText(); | 18 window.testRunner.dumpAsText(); |
| 19 | 19 |
| 20 var menulist = document.getElementById("menulist"); | 20 var menulist = document.getElementById("menulist"); |
| 21 menulist.selectedIndex = 0; | 21 menulist.selectedIndex = 0; |
| 22 | 22 |
| 23 var axMenuList = accessibilityController.accessibleElementById("menulist"); |
| 24 var axMenuListPopup = axMenuList.childAtIndex(0); |
| 25 shouldBe("axMenuListPopup.role", "\"AXRole: AXMenuListPopup\""); |
| 26 var axMenuListOption = axMenuListPopup.childAtIndex(0); |
| 27 shouldBe("axMenuListOption.role", "\"AXRole: AXMenuListOption\""); |
| 28 |
| 29 window.setTimeout(function() { |
| 30 |
| 23 // Explore the whole accessibility tree. State change events won't fire on a
ccessible objects that haven't | 31 // Explore the whole accessibility tree. State change events won't fire on a
ccessible objects that haven't |
| 24 // been created yet. | 32 // been created yet. |
| 25 accessibilityController.accessibleElementById('foo'); | 33 accessibilityController.accessibleElementById('foo'); |
| 26 | 34 |
| 27 var result = ""; | 35 var result = ""; |
| 28 accessibilityController.addNotificationListener(function(element, notificati
on) { | 36 accessibilityController.addNotificationListener(function(element, notificati
on) { |
| 29 if (element.role == "AXRole: AXMenuListOption") { | 37 if (element.stringValue == axMenuListOption.stringValue) { |
| 30 debug("Got notification on option " + element.stringValue + " isSele
cted=" + element.isSelected); | 38 window.element = element; |
| 31 if (element.isSelected) | 39 shouldBe("element.isEqual(axMenuListOption)", "true"); |
| 32 finishJSTest(); | 40 shouldBe("element.parentElement().isEqual(axMenuListPopup)", "true")
; |
| 41 finishJSTest(); |
| 33 } | 42 } |
| 34 }); | 43 }); |
| 35 | 44 |
| 36 menulist.selectedIndex = 2; | 45 menulist.selectedIndex = 1; |
| 46 }, 0); |
| 37 } | 47 } |
| 38 | 48 |
| 39 </script> | 49 </script> |
| 40 | 50 |
| 41 </body> | 51 </body> |
| 42 </html> | 52 </html> |
| OLD | NEW |