editor/libeditor/text/tests/test_bug681229.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/editor/libeditor/text/tests/test_bug681229.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,51 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<!--
     1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=681229
     1.8 +-->
     1.9 +<head>
    1.10 +  <title>Test for Bug 681229</title>
    1.11 +  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.12 +  <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
    1.13 +  <script type="text/javascript" src="/tests/SimpleTest/WindowSnapshot.js"></script>
    1.14 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    1.15 +</head>
    1.16 +<body>
    1.17 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=681229">Mozilla Bug 681229</a>
    1.18 +<p id="display"></p>
    1.19 +<div id="content">
    1.20 +<textarea spellcheck="false"></textarea>
    1.21 +</div>
    1.22 +<pre id="test">
    1.23 +<script type="application/javascript">
    1.24 +
    1.25 +/** Test for Bug 681229 **/
    1.26 +
    1.27 +SimpleTest.waitForExplicitFinish();
    1.28 +SimpleTest.waitForFocus(function() {
    1.29 +  var t = document.querySelector("textarea");
    1.30 +  t.focus();
    1.31 +
    1.32 +  const kValue = "a\r\nb";
    1.33 +  const kExpectedValue = (navigator.platform.indexOf("Win") == 0) ?
    1.34 +    "a\nb" : kValue;
    1.35 +
    1.36 +  SimpleTest.waitForClipboard(kExpectedValue,
    1.37 +    function() {
    1.38 +      SpecialPowers.copyString(kValue, document);
    1.39 +    },
    1.40 +    function() {
    1.41 +      synthesizeKey("V", {accelKey: true});
    1.42 +      is(t.value, "a\nb", "The carriage return has been correctly sanitized");
    1.43 +      SimpleTest.finish();
    1.44 +    },
    1.45 +    function() {
    1.46 +      SimpleTest.finish();
    1.47 +    }
    1.48 +  );
    1.49 +});
    1.50 +
    1.51 +</script>
    1.52 +</pre>
    1.53 +</body>
    1.54 +</html>

mercurial