editor/libeditor/text/tests/test_bug600570.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=600570
michael@0 5 -->
michael@0 6 <head>
michael@0 7 <title>Test for Bug 600570</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=600570">Mozilla Bug 600570</a>
michael@0 15 <p id="display"></p>
michael@0 16 <div id="content">
michael@0 17 <textarea spellcheck="false">
michael@0 18 aaa
michael@0 19 [bbb]</textarea>
michael@0 20 </div>
michael@0 21 <pre id="test">
michael@0 22 <script type="application/javascript">
michael@0 23
michael@0 24 /** Test for Bug 600570 **/
michael@0 25
michael@0 26 // Bug 718316: This test fails on Windows 7 and 8
michael@0 27 if (navigator.userAgent.indexOf("Windows NT 6.1") == -1 &&
michael@0 28 navigator.userAgent.indexOf("Windows NT 6.2") == -1) {
michael@0 29
michael@0 30 SimpleTest.waitForExplicitFinish();
michael@0 31 SimpleTest.waitForFocus(function() {
michael@0 32 var t = document.querySelector("textarea");
michael@0 33 t.value = "[aaa\nbbb]";
michael@0 34 t.focus();
michael@0 35 synthesizeKey("A", {accelKey: true});
michael@0 36
michael@0 37 SimpleTest.executeSoon(function() {
michael@0 38 t.getBoundingClientRect(); // flush layout
michael@0 39 var afterSetValue = snapshotWindow(window);
michael@0 40
michael@0 41 t.value = t.defaultValue;
michael@0 42
michael@0 43 t.selectionStart = 0;
michael@0 44 t.selectionEnd = 4;
michael@0 45 SimpleTest.waitForClipboard("aaa\n",
michael@0 46 function() {
michael@0 47 synthesizeKey("X", {accelKey: true});
michael@0 48 },
michael@0 49 function() {
michael@0 50 t.addEventListener("input", function() {
michael@0 51 t.removeEventListener("input", arguments.callee, false);
michael@0 52
michael@0 53 setTimeout(function() { // Avoid the assertion in bug 649797
michael@0 54 is(t.value, "[aaa\nbbb]", "The value of the textarea should be correct");
michael@0 55 synthesizeKey("A", {accelKey: true});
michael@0 56 is(t.selectionStart, 0, "Select all should set the selection start to the beginning of textarea");
michael@0 57 is(t.selectionEnd, 9, "Select all should set the selection end to the end of textarea");
michael@0 58
michael@0 59 var afterPaste = snapshotWindow(window);
michael@0 60
michael@0 61 var res = compareSnapshots(afterSetValue, afterPaste, true);
michael@0 62 var msg = "Pasting and setting the value directly should result in the same rendering";
michael@0 63 if (!res[0]) {
michael@0 64 msg += "\nRESULT:\n" + res[2] + "\nREFERENCE:\n" + res[1];
michael@0 65 }
michael@0 66 ok(res[0], msg);
michael@0 67
michael@0 68 SimpleTest.finish();
michael@0 69 }, 0);
michael@0 70 }, false);
michael@0 71 synthesizeKey("VK_RIGHT", {});
michael@0 72 synthesizeKey("V", {accelKey: true});
michael@0 73 },
michael@0 74 function() {
michael@0 75 SimpleTest.finish();
michael@0 76 }
michael@0 77 );
michael@0 78 });
michael@0 79 });
michael@0 80
michael@0 81 }
michael@0 82 else {
michael@0 83 ok(true, "Somebody thought it was a great idea to make me type this.");
michael@0 84 }
michael@0 85
michael@0 86 </script>
michael@0 87 </pre>
michael@0 88 </body>
michael@0 89 </html>

mercurial