test_bug1153237.html (1340B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=1153237 5 --> 6 <head> 7 <meta charset="utf-8"> 8 <title>Test for Bug 1153237</title> 9 <script src="/tests/SimpleTest/SimpleTest.js"></script> 10 <link rel="stylesheet" href="/tests/SimpleTest/test.css"/> 11 <script type="application/javascript"> 12 13 SimpleTest.waitForExplicitFinish(); 14 15 // Avoid platform selection differences 16 SimpleTest.waitForFocus(function() { 17 SpecialPowers.pushPrefEnv({ 18 "set": [["layout.word_select.eat_space_to_next_word", true]], 19 }, runTests); 20 }); 21 22 function runTests() { 23 var element = document.getElementById("editor"); 24 var sel = window.getSelection(); 25 26 element.focus(); 27 is(sel.getRangeAt(0).startOffset, 0, "offset is zero"); 28 29 SpecialPowers.doCommand(window, "cmd_selectRight2"); 30 is(sel.toString(), "Some ", 31 "first word + space is selected: got '" + sel.toString() + "'"); 32 33 SpecialPowers.doCommand(window, "cmd_selectRight2"); 34 is(sel.toString(), "Some text", 35 "both words are selected: got '" + sel.toString() + "'"); 36 37 SimpleTest.finish(); 38 } 39 </script> 40 </head> 41 <body> 42 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1153237">Mozilla Bug 1153237</a> 43 <div id="editor" contenteditable>Some text</div><span></span> 44 45 <pre id="test"> 46 </pre> 47 </body> 48 </html>