|
1 <!DOCTYPE HTML> |
|
2 <html> |
|
3 <!-- |
|
4 https://bugzilla.mozilla.org/show_bug.cgi?id=596506 |
|
5 --> |
|
6 <head> |
|
7 <title>Test for Bug 596506</title> |
|
8 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
|
9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> |
|
10 <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script> |
|
11 </head> |
|
12 <body> |
|
13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=596506">Mozilla Bug 596506</a> |
|
14 <p id="display"></p> |
|
15 <div id="content" style="display: none"> |
|
16 |
|
17 </div> |
|
18 <pre id="test"> |
|
19 <script type="application/javascript"> |
|
20 |
|
21 /** Test for Bug 596506 **/ |
|
22 |
|
23 SimpleTest.waitForExplicitFinish(); |
|
24 SimpleTest.waitForFocus(runTest); |
|
25 |
|
26 const kIsMac = navigator.platform.indexOf("Mac") == 0; |
|
27 |
|
28 function append(str) { |
|
29 for (var i = 0; i < str.length; ++i) { |
|
30 synthesizeKey(str[i], {}); |
|
31 } |
|
32 } |
|
33 |
|
34 function runTest() { |
|
35 var edit = document.getElementById("edit"); |
|
36 edit.focus(); |
|
37 |
|
38 append("First"); |
|
39 synthesizeKey("VK_RETURN", {}); |
|
40 append("Second"); |
|
41 synthesizeKey("VK_UP", {}); |
|
42 synthesizeKey("VK_UP", {}); |
|
43 if (kIsMac) { |
|
44 synthesizeKey("VK_RIGHT", {accelKey: true}); |
|
45 } else { |
|
46 synthesizeKey("VK_END", {}); |
|
47 } |
|
48 append("ly"); |
|
49 is(edit.value, "Firstly\nSecond", |
|
50 "Pressing end should position the cursor before the terminating newline"); |
|
51 SimpleTest.finish(); |
|
52 } |
|
53 |
|
54 </script> |
|
55 </pre> |
|
56 |
|
57 <textarea id="edit"></textarea> |
|
58 |
|
59 </body> |
|
60 </html> |