test_bug333064.html (2061B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=333064 5 --> 6 <head> 7 <title>Test for Bug 333064</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=333064">Mozilla Bug 333064</a> 14 <p id="display"></p> 15 16 <div id="display"> 17 </div> 18 <div id="korean-text">안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안안</div> 19 20 <pre id="test"> 21 </pre> 22 23 <script class="testbody" type="application/javascript"> 24 25 /** Test for Bug 333064 */ 26 SimpleTest.waitForExplicitFinish(); 27 SimpleTest.waitForFocus(function() { 28 var div = document.getElementById("korean-text"); 29 var sel = window.getSelection(); 30 31 // Select text node in div. 32 var r = document.createRange(); 33 r.setStart(div, 0); 34 r.setEnd(div, 1); 35 sel.addRange(r); 36 37 SimpleTest.waitForClipboard( 38 function compare(value) { 39 // Make sure we got the HTML flavour we asked for and that our 40 // string is included without additional spaces. 41 return ( 42 (SpecialPowers.getBoolPref("dom.serializer.includeCommonAncestor.enabled") 43 ? value.includes("korean-text") 44 : !value.includes("korean-text")) && value.includes("안".repeat(160)) 45 ); 46 }, 47 function setup() { 48 synthesizeKey("C", {accelKey: true}); 49 }, 50 function onSuccess() { 51 SimpleTest.finish(); 52 }, 53 function onFailure() { 54 SimpleTest.finish(); 55 }, 56 "text/html" 57 ); 58 }); 59 60 </script> 61 62 </body> 63 </html>