OLD | NEW |
---|---|
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <script> | 3 <script> |
4 | 4 |
5 function log(str) | 5 function log(str) |
6 { | 6 { |
7 var li = document.createElement("li"); | 7 var li = document.createElement("li"); |
8 li.appendChild(document.createTextNode(str)); | 8 li.appendChild(document.createTextNode(str)); |
9 var console = document.getElementById("console"); | 9 var console = document.getElementById("console"); |
10 console.appendChild(li); | 10 console.appendChild(li); |
11 } | 11 } |
12 | 12 |
13 function runTest() | 13 function runTest() |
14 { | 14 { |
15 if (window.testRunner) | 15 if (window.testRunner) |
16 testRunner.dumpAsText(); | 16 testRunner.dumpAsText(); |
17 | 17 |
18 if (!window.eventSender) | 18 if (!window.eventSender) |
19 return; | 19 return; |
20 | 20 |
21 var textarea = document.getElementById("test"); | 21 var textarea = document.getElementById("test"); |
22 | 22 |
23 // set the cursor several characters into the first line of the text area so | 23 // set the cursor several characters into the first line of the text area so |
24 // that when you go down by a line, the cursor will be at the end of the | 24 // that when you go down by a line, the cursor will be at the end of the |
25 // numbered lines: | 25 // numbered lines: |
26 textarea.setSelectionRange(5, 5); | 26 var startX = textarea.offsetLeft + 30; |
tkent
2014/06/01 23:40:55
Ditto.
harpreet.sk
2014/07/02 10:13:05
Done.
| |
27 var startY = textarea.offsetTop + 4; | |
28 eventSender.mouseMoveTo(startX,startY); | |
29 eventSender.mouseDown(); | |
30 eventSender.mouseUp(); | |
27 for (var i = 0; i < 10; i++) { | 31 for (var i = 0; i < 10; i++) { |
28 // press the 'down arrow' a bunch of times to try to get to the end of t he text area | 32 // press the 'down arrow' a bunch of times to try to get to the end of t he text area |
29 eventSender.keyDown("downArrow"); | 33 eventSender.keyDown("downArrow"); |
30 } | 34 } |
31 if (textarea.selectionStart != textarea.value.length) | 35 if (textarea.selectionStart != textarea.value.length) |
32 log("Fail. Expected: selectionStart == " + textarea.value.length + ", F ound: " + textarea.selectionStart); | 36 log("Fail. Expected: selectionStart == " + textarea.value.length + ", F ound: " + textarea.selectionStart); |
33 else | 37 else |
34 log("Success"); | 38 log("Success"); |
35 } | 39 } |
36 | 40 |
(...skipping 12 matching lines...) Expand all Loading... | |
49 1. | 53 1. |
50 2. | 54 2. |
51 3. | 55 3. |
52 | 56 |
53 What is the expected output? What do you see instead?</textarea> | 57 What is the expected output? What do you see instead?</textarea> |
54 | 58 |
55 <ul id="console"></ul> | 59 <ul id="console"></ul> |
56 | 60 |
57 </body> | 61 </body> |
58 </html> | 62 </html> |
OLD | NEW |