test_bug596001.html (1454B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=596001 5 --> 6 <head> 7 <title>Test for Bug 596001</title> 8 <script src="/tests/SimpleTest/SimpleTest.js"></script> 9 <script src="/tests/SimpleTest/EventUtils.js"></script> 10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 11 </head> 12 <body> 13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=596001">Mozilla Bug 596001</a> 14 <p id="display"></p> 15 <div id="content"> 16 <textarea id="src">a	b</textarea> 17 <textarea id="dst"></textarea> 18 </div> 19 <pre id="test"> 20 <script type="application/javascript"> 21 22 /** Test for Bug 596001 */ 23 24 function testTab(prefix, callback) { 25 var src = document.getElementById("src"); 26 var dst = document.getElementById("dst"); 27 dst.value = prefix; 28 src.focus(); 29 src.select(); 30 SimpleTest.waitForClipboard("a\tb", 31 function() { 32 synthesizeKey("c", {accelKey: true}); 33 }, 34 function() { 35 dst.focus(); 36 var inputReceived = false; 37 dst.addEventListener("input", function() { inputReceived = true; }); 38 synthesizeKey("v", {accelKey: true}); 39 ok(inputReceived, "An input event should be raised"); 40 is(dst.value, prefix + src.value, "The value should be pasted verbatim"); 41 callback(); 42 }, 43 callback 44 ); 45 } 46 47 SimpleTest.waitForExplicitFinish(); 48 testTab("", function() { 49 testTab("foo", function() { 50 SimpleTest.finish(); 51 }); 52 }); 53 54 </script> 55 </pre> 56 </body> 57 </html>