test_bug1394758.html (1598B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=1394758 5 --> 6 <head> 7 <title>Test for Bug1394758</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=1394758">Mozilla Bug 1394758</a> 14 <p id="display"></p> 15 <div id="content"> 16 <div id="editable" contenteditable="true"> 17 <span id="span" contenteditable="false"> 18 Hello 19 </span> 20 World 21 </div> 22 </div> 23 <pre id="test"> 24 <script type="application/javascript"> 25 26 /** Test for Bug 611182 */ 27 SimpleTest.waitForExplicitFinish(); 28 SimpleTest.waitForFocus(function() { 29 var editable = document.getElementById("editable"); 30 var span = document.getElementById("span"); 31 var beforeSpan = span.textContent; 32 33 editable.focus(); 34 window.getSelection().collapse(span.nextSibling, 0); 35 36 synthesizeKey("KEY_ArrowRight"); 37 synthesizeKey("KEY_ArrowRight"); 38 synthesizeKey("KEY_Backspace"); 39 synthesizeKey("KEY_Backspace"); 40 41 is(span.textContent, beforeSpan, 42 "VK_BACK_SPACE should not modify non-editable area"); 43 is(span.nextSibling.textContent.trim(), "rld", 44 "VK_BACK_SPACE should delete first 2 characters"); 45 46 synthesizeKey("KEY_Delete"); 47 48 is(span.textContent, beforeSpan, 49 "VK_DELETE should not modify non-editable area"); 50 is(span.nextSibling.textContent.trim(), "ld", 51 "VK_DELETE should delete first character"); 52 53 SimpleTest.finish(); 54 }); 55 56 </script> 57 </pre> 58 </body> 59 </html>