<!DOCTYPE html>
<html>
<head>
<script src="../resources/js-test.js"></script>
</head>
<body>
<input type="text" id="input" value="Line 1">
<script>
description("This tests that caret position is reported correctly for text input elements.");
if (window.accessibilityController) {
let input = document.getElementById('input');
input.focus();
window.inputAccessible =
accessibilityController.accessibleElementById('input');
for (let characterIndex = 0; characterIndex < 7; ++characterIndex) {
input.setSelectionRange(characterIndex, characterIndex);
shouldBe("inputAccessible", "inputAccessible.selectionAnchorObject");
shouldBeEqualToNumber("inputAccessible.selectionAnchorOffset",
characterIndex);
shouldBe("inputAccessible", "inputAccessible.selectionFocusObject");
shouldBeEqualToNumber("inputAccessible.selectionFocusOffset",
characterIndex);
}
}
</script>
</body>
</html>