~ubuntu-branches/ubuntu/raring/qtwebkit-source/raring-proposed

« back to all changes in this revision

Viewing changes to ManualTests/selection-start-after-inserting-line-break-in-textarea.html

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2013-02-18 14:24:18 UTC
  • Revision ID: package-import@ubuntu.com-20130218142418-eon0jmjg3nj438uy
Tags: upstream-2.3
ImportĀ upstreamĀ versionĀ 2.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<!DOCTYPE html>
 
2
<html>
 
3
<body>
 
4
<p>This tests selectionStart is updated properly when inserting LF into textarea. To test, press Enter several times inside textarea and click the log button. This bug does not reproduce when new lines are added by execCommand or eventSender.</p>
 
5
<textarea cols="20" rows="20"></textarea>
 
6
<button id="button" onclick="verify()">verify</button>
 
7
<div id="console"></div>
 
8
<script>
 
9
 
 
10
function verify() {
 
11
    var console = document.getElementById('console');
 
12
    if (textarea.value.match(/[^\n]/))
 
13
        console.innerHTML = 'textarea contains unexpected character. You can only type LF in this test.';
 
14
    else if (textarea.selectionStart != textarea.value.length)
 
15
        console.innerHTML = 'FAIL: expected ' + textarea.value.length + ' but got ' + textarea.selectionStart;
 
16
    else
 
17
        console.innerHTML = 'PASS: ' + textarea.value.length + ' LFs';
 
18
}
 
19
 
 
20
var textarea = document.getElementsByTagName('textarea')[0];
 
21
textarea.focus();
 
22
 
 
23
</script>
 
24
</body>
 
25
</html>