blob: a76c207a5b46ab3f315680c1096f946f5679ebf7 [file] [log] [blame]
<!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);
// 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("axCombo.isFocusable", "true");
shouldBe("axMenuItemFoo.isFocusable", "false");
shouldBe("axMenuItemBar.isFocusable", "false");
shouldBe("axMenuItemFoo.isSelectable", "true");
shouldBe("axMenuItemBar.isSelectable", "true");
shouldBe("axCombo.isFocused", "false");
shouldBe("axMenuItemFoo.isSelected", "true");
shouldBe("axMenuItemBar.isSelected", "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");
// Move to the next element in the combo box
eventSender.keyDown("downArrow");
shouldBe("axCombo.isFocused", "true");
shouldBe("axMenuItemFoo.isSelected", "false");
shouldBe("axMenuItemBar.isSelected", "true");
// 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");
}
}
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>