4 <script src=
"../resources/js-test.js"></script>
8 <div id=
"editable-div" contenteditable
>
10 <p>line
2<br>line
3</p>
14 description("This tests that the line number of a character offset is computed correctly for content editable elements.");
16 if (window
.accessibilityController
) {
18 var div
= document
.getElementById("editable-div");
20 var axEditable
= accessibilityController
.focusedElement
;
22 for (var line
= 0; line
< 3; ++line
) {
23 for (var character
= 0; character
< 7; ++character
) {
24 var index
= line
* 7 + character
;
25 shouldBeEqualToNumber("axEditable.lineForIndex(index)", line
);
29 // Placing the caret after the last character should not change the line.
30 var textLength
= div
.innerText
.length
;
31 shouldBeEqualToNumber("textLength", 20);
32 shouldBeEqualToNumber("axEditable.lineForIndex(textLength)", 2);