<rdar://problem/6084806> AX: REGRESSION: returned line number from TextArea is incorrect
[WebKit-https.git] / LayoutTests / accessibility / textarea-insertion-point-line-number.html
1 <html>
2 <script>
3     if (window.layoutTestController)
4         layoutTestController.dumpAsText();
5 </script>
6 <body>
7     
8     <div id="result"></div>
9     
10     <textarea name="area1" id="area1" rows="5" cols="40">
11 line 1
12 line 2
13 line 3
14     </textarea>
15
16     <textarea name="area2" id="area2" rows="5" cols="40"></textarea>
17      
18     <script>
19         if (window.accessibilityController) {
20             var result = document.getElementById("result");
21
22             var area1 = document.getElementById("area1");
23             area1.focus();
24
25             for (var k = 0; k < 3; k++) {
26                 area1.selectionStart = (k*7);
27                 area1.selectionEnd = (k*7);
28                 var lineNumber = accessibilityController.focusedElement.insertionPointLineNumber;            
29                 if (lineNumber == k) {
30                     result.innerText += "Test:" + k + ") Line Number: Pass [" + area1.selectionStart + "->" + lineNumber + "]\n";       
31                 }
32                 else {
33                     result.innerText += "Test:" + k + ") Line Number: Fail [" + area1.selectionStart + "->" + lineNumber + "]\n";       
34                 }
35             }
36
37             var area2 = document.getElementById("area2");
38             area2.focus();
39             var lineNumber = accessibilityController.focusedElement.insertionPointLineNumber
40             result.innerText += "Not focused on text area line number: " + lineNumber + "\n";
41         }
42     </script>
43 </body>
44 </html>