test_bug358033.html (1243B)
1 <!DOCTYPE html> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=358033 5 --> 6 <head> 7 <title>Test for Bug 358033</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=358033">Mozilla Bug 358033</a> 14 <p id="display"></p> 15 <div id="content"> 16 <input type="text" id="input1"> 17 </div> 18 <pre id="test"> 19 <script> 20 SimpleTest.waitForExplicitFinish(); 21 SimpleTest.waitForFocus(function() { 22 let input = document.getElementById("input1"); 23 24 input.value = "ABC DEF"; 25 input.focus(); 26 input.setSelectionRange(4, 7, "backward"); 27 synthesizeKey("KEY_Backspace"); 28 is(input.value, "ABC ", "KEY_Backspace should remove selected string"); 29 synthesizeKey("Z", { accelKey: true }); 30 is(input.value, "ABC DEF", "Undo should restore string"); 31 synthesizeKey("KEY_ArrowLeft", { shiftKey: true }); 32 synthesizeKey("KEY_ArrowLeft", { shiftKey: true }); 33 synthesizeKey("KEY_Backspace"); 34 35 is(input.value, "AB", "anchor node and focus node should be kept order after undo"); 36 37 SimpleTest.finish(); 38 }); 39 </script> 40 </body> 41 </html>