test_bug1581337.html (1175B)
1 <!DOCTYPE html> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=1581337 5 --> 6 <head> 7 <title>Test for Bug 1581337</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=1581337">Mozilla Bug 1581337</a> 14 <p id="display"></p> 15 16 <div id="editor" contenteditable><span _moz_quote="true">foo bar</span></div> 17 </body> 18 <script> 19 SimpleTest.waitForExplicitFinish(); 20 SimpleTest.waitForFocus(() => { 21 let editor = document.getElementById("editor"); 22 editor.focus(); 23 let selection = document.getSelection(); 24 selection.collapse(editor.firstChild.firstChild, 4); 25 synthesizeKey("KEY_Backspace"); 26 // FYI: `_moz_quote` attribute is ignored at serializing HTML content. 27 is(editor.innerHTML, "<span>foobar</span>", "Backspace should delete the previous whitespace"); 28 synthesizeKey("KEY_Delete"); 29 is(editor.innerHTML, "<span>fooar</span>", "Delete should delete the next character, \"b\""); 30 SimpleTest.finish(); 31 }); 32 </script> 33 </html>