editor/libeditor/text/tests/test_bug597331.html

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 <!DOCTYPE HTML>
michael@0 2 <html>
michael@0 3 <!--
michael@0 4 https://bugzilla.mozilla.org/show_bug.cgi?id=597331
michael@0 5 -->
michael@0 6 <head>
michael@0 7 <title>Test for Bug 597331</title>
michael@0 8 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
michael@0 9 <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
michael@0 10 <script type="text/javascript" src="/tests/SimpleTest/WindowSnapshot.js"></script>
michael@0 11 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
michael@0 12 </head>
michael@0 13 <body>
michael@0 14 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=597331">Mozilla Bug 597331</a>
michael@0 15 <p id="display"></p>
michael@0 16 <div id="content">
michael@0 17 <textarea>line1
michael@0 18 line2
michael@0 19 line3
michael@0 20 </textarea>
michael@0 21 </div>
michael@0 22 <pre id="test">
michael@0 23 <script type="application/javascript">
michael@0 24
michael@0 25 /** Test for Bug 597331 **/
michael@0 26
michael@0 27 // Bug 718316: This test fails on Windows 7 and 8
michael@0 28 if (navigator.userAgent.indexOf("Windows NT 6.1") == -1 &&
michael@0 29 navigator.userAgent.indexOf("Windows NT 6.2") == -1) {
michael@0 30
michael@0 31 SimpleTest.waitForExplicitFinish();
michael@0 32 addLoadEvent(function() {
michael@0 33 SimpleTest.executeSoon(function() {
michael@0 34 var t = document.querySelector("textarea");
michael@0 35 t.focus();
michael@0 36 t.selectionStart = 4;
michael@0 37 t.selectionEnd = 4;
michael@0 38 SimpleTest.executeSoon(function() {
michael@0 39 t.getBoundingClientRect(); // flush layout
michael@0 40 var before = snapshotWindow(window, true);
michael@0 41 t.selectionStart = 5;
michael@0 42 t.selectionEnd = 5;
michael@0 43 t.addEventListener("keydown", function() {
michael@0 44 t.removeEventListener("keydown", arguments.callee, false);
michael@0 45
michael@0 46 SimpleTest.executeSoon(function() {
michael@0 47 t.style.display = 'block';
michael@0 48 document.body.offsetWidth;
michael@0 49 t.style.display = '';
michael@0 50 document.body.offsetWidth;
michael@0 51
michael@0 52 is(t.selectionStart, 4, "Cursor should be moved correctly");
michael@0 53 is(t.selectionEnd, 4, "Cursor should be moved correctly");
michael@0 54
michael@0 55 var after = snapshotWindow(window, true);
michael@0 56
michael@0 57 var result = compareSnapshots(before, after, true);
michael@0 58 var msg = "The caret should be displayed correctly after reframing";
michael@0 59 if (!result[0]) {
michael@0 60 msg += "\nRESULT:\n" + result[2];
michael@0 61 msg += "\nREFERENCE:\n" + result[1];
michael@0 62 }
michael@0 63 ok(result[0], msg);
michael@0 64
michael@0 65 SimpleTest.finish();
michael@0 66 });
michael@0 67 }, false);
michael@0 68 synthesizeKey("VK_LEFT", {});
michael@0 69 });
michael@0 70 });
michael@0 71 });
michael@0 72
michael@0 73 }
michael@0 74 else {
michael@0 75 ok(true, "Somebody thought it was a great idea to make me type this.");
michael@0 76 }
michael@0 77
michael@0 78 </script>
michael@0 79 </pre>
michael@0 80 </body>
michael@0 81 </html>

mercurial