editor/libeditor/text/tests/test_bug596506.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/editor/libeditor/text/tests/test_bug596506.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,60 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<!--
     1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=596506
     1.8 +-->
     1.9 +<head>
    1.10 +  <title>Test for Bug 596506</title>
    1.11 +  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.12 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    1.13 +  <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
    1.14 +</head>
    1.15 +<body>
    1.16 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=596506">Mozilla Bug 596506</a>
    1.17 +<p id="display"></p>
    1.18 +<div id="content" style="display: none">
    1.19 +
    1.20 +</div>
    1.21 +<pre id="test">
    1.22 +<script type="application/javascript">
    1.23 +
    1.24 +/** Test for Bug 596506 **/
    1.25 +
    1.26 +SimpleTest.waitForExplicitFinish();
    1.27 +SimpleTest.waitForFocus(runTest);
    1.28 +
    1.29 +const kIsMac = navigator.platform.indexOf("Mac") == 0;
    1.30 +
    1.31 +function append(str) {
    1.32 +  for (var i = 0; i < str.length; ++i) {
    1.33 +    synthesizeKey(str[i], {});
    1.34 +  }
    1.35 +}
    1.36 +
    1.37 +function runTest() {
    1.38 +  var edit = document.getElementById("edit");
    1.39 +  edit.focus();
    1.40 +
    1.41 +  append("First");
    1.42 +  synthesizeKey("VK_RETURN", {});
    1.43 +  append("Second");
    1.44 +  synthesizeKey("VK_UP", {});
    1.45 +  synthesizeKey("VK_UP", {});
    1.46 +  if (kIsMac) {
    1.47 +    synthesizeKey("VK_RIGHT", {accelKey: true});
    1.48 +  } else {
    1.49 +    synthesizeKey("VK_END", {});
    1.50 +  }
    1.51 +  append("ly");
    1.52 +  is(edit.value, "Firstly\nSecond",
    1.53 +     "Pressing end should position the cursor before the terminating newline");
    1.54 +  SimpleTest.finish();
    1.55 +}
    1.56 +
    1.57 +</script>
    1.58 +</pre>
    1.59 +
    1.60 +<textarea id="edit"></textarea>
    1.61 +
    1.62 +</body>
    1.63 +</html>

mercurial