layout/base/tests/test_bug582181-2.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/layout/base/tests/test_bug582181-2.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,63 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<!--
     1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=582181
     1.8 +-->
     1.9 +<head>
    1.10 +  <title>Test for Bug 582181</title>
    1.11 +  <meta charset="utf-8">
    1.12 +  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.13 +  <script type="text/javascript" src="/tests/SimpleTest/WindowSnapshot.js"></script>
    1.14 +  <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
    1.15 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
    1.16 +</head>
    1.17 +<body onload="test()">
    1.18 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=582181">Mozilla Bug 582181</a>
    1.19 +<p id="display"></p>
    1.20 +<div id="content" dir="rtl">
    1.21 +<textarea rows="5" id="testInput">Blah blah
    1.22 +فلان فلان
    1.23 +&lt;ref&gt;ooo&lt;/ref&gt;
    1.24 +&lt;references /&gt;</textarea>
    1.25 +</div>
    1.26 +<pre id="test">
    1.27 +<script class="testbody" type="text/javascript">
    1.28 +
    1.29 +/** Test for Bug 582181 **/
    1.30 +
    1.31 +SimpleTest.waitForExplicitFinish();
    1.32 +
    1.33 +function test() {
    1.34 +  var textInput = $("testInput");
    1.35 +  var s1, s2, s3, equal, str1, str2;
    1.36 +
    1.37 +  s1 = snapshotWindow(window);
    1.38 +
    1.39 +  textInput.focus();
    1.40 +  synthesizeKey("VK_DOWN", { });
    1.41 +  synthesizeKey("VK_DOWN", { });
    1.42 +  synthesizeKey("VK_DOWN", { });
    1.43 +  synthesizeKey("VK_DOWN", { });
    1.44 +  synthesizeKey("VK_BACK_SPACE", { });
    1.45 +  textInput.blur();
    1.46 +  s2 = snapshotWindow(window);
    1.47 +
    1.48 +  [unequal, str1, str2] = compareSnapshots(s1, s2, false);
    1.49 +  ok(unequal, "backspace after text should change rendering: got " + str2);
    1.50 +
    1.51 +  textInput.focus();
    1.52 +  synthesizeKey(">", { });
    1.53 +  textInput.blur();
    1.54 +  s3 = snapshotWindow(window);
    1.55 +
    1.56 +  [equal, str1, str2] = compareSnapshots(s1, s3, true);
    1.57 +  ok(equal, "entering '>' should restore original rendering: expected " + str1 + 
    1.58 +     " but got " + str2);
    1.59 +
    1.60 +  SimpleTest.finish();
    1.61 +}
    1.62 +
    1.63 +</script>
    1.64 +</pre>
    1.65 +</body>
    1.66 +</html>

mercurial