blob: d40831830b21807ae07636188fff40c0c4da5f65 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../resources/js-test.js"></script>
</head>
<body>
<textarea name="area1" id="area1" rows="5" cols="40">
line 1
line 2
line 3</textarea>
<script>
description("This tests that the line number of a character offset is computed correctly for textarea elements.");
if (window.accessibilityController) {
var area1 = document.getElementById("area1");
area1.focus();
var axArea1 = accessibilityController.focusedElement;
for (var line = 0; line < 3; ++line) {
for (var character = 0; character < 7; ++character) {
var index = line * 7 + character;
shouldBeEqualToNumber("axArea1.lineForIndex(index)", line);
}
}
// Placing the caret after the last character should not change the line.
shouldBeEqualToNumber("axArea1.lineForIndex(area1.textLength)", 2);
}
</script>
</body>
</html>