| <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
| <html> |
| <head> |
| <script src="../../resources/js-test-pre.js"></script> |
| </head> |
| <body id="body"> |
| <select id="combo"> |
| <option value='foo'>foo</option> |
| <option value='bar'>bar</option> |
| </select> |
| <p id="par1">A paragraph with a single line</p> |
| <div id="console"></div> |
| <script> |
| description("This tests caret browsing for html select elements."); |
| |
| if (window.testRunner && window.internals) { |
| internals.settings.setCaretBrowsingEnabled(true); |
| testRunner.dumpAsText(); |
| |
| if (window.accessibilityController) { |
| |
| document.getElementById("body").focus(); |
| var webArea = accessibilityController.focusedElement; |
| |
| var axCombo = webArea.childAtIndex(0).childAtIndex(0); |
| var axMenuItemFoo = axCombo.childAtIndex(0).childAtIndex(0); |
| var axMenuItemBar = axCombo.childAtIndex(0).childAtIndex(1); |
| var axPar = webArea.childAtIndex(1); |
| |
| // Check roles and initial states |
| // Move the caret once to force the focus onto this toplevel |
| var par1 = document.getElementById("par1"); |
| window.getSelection().setPosition(par1, 10); |
| eventSender.keyDown("rightArrow"); |
| shouldBe("axCombo.role", "'AXRole: AXComboBox'"); |
| shouldBe("axMenuItemFoo.role", "'AXRole: AXMenuItem'"); |
| shouldBe("axPar.role", "'AXRole: AXParagraph'"); |
| shouldBe("axCombo.isFocusable", "true"); |
| shouldBe("axMenuItemFoo.isFocusable", "false"); |
| shouldBe("axMenuItemBar.isFocusable", "false"); |
| shouldBe("axMenuItemFoo.isSelectable", "true"); |
| shouldBe("axMenuItemBar.isSelectable", "true"); |
| shouldBe("axPar.isFocusable", "true"); |
| shouldBe("axCombo.isFocused", "false"); |
| shouldBe("axMenuItemFoo.isSelected", "true"); |
| shouldBe("axMenuItemBar.isSelected", "false"); |
| shouldBe("axPar.isFocused", "false"); |
| |
| // set the focus on the paragraph |
| // "Tab" into the combo |
| eventSender.keyDown('\t', ["shiftKey"]); |
| shouldBe("axCombo.isFocused", "true"); |
| shouldBe("axMenuItemFoo.isSelected", "true"); |
| shouldBe("axMenuItemBar.isSelected", "false"); |
| shouldBe("axPar.isFocused", "false"); |
| |
| // Move to the next element in the combo box |
| eventSender.keyDown("downArrow"); |
| shouldBe("axCombo.isFocused", "true"); |
| shouldBe("axMenuItemFoo.isSelected", "false"); |
| shouldBe("axMenuItemBar.isSelected", "true"); |
| shouldBe("axPar.isFocused", "false"); |
| |
| // Press the right arrow to exit the combo (this moves to the html body). |
| // Then press the down arrow to enter the paragraph. |
| var combo = document.getElementById("combo"); |
| eventSender.keyDown("rightArrow"); |
| eventSender.keyDown("downArrow"); |
| shouldBe("axCombo.isFocused", "false"); |
| shouldBe("axMenuItemFoo.isSelected", "false"); |
| shouldBe("axMenuItemBar.isSelected", "true"); |
| shouldBe("axPar.isFocused", "true"); |
| |
| } |
| } |
| |
| </script> |
| <script src="../../resources/js-test-post.js"></script> |
| </body> |
| </html> |