test_texteditor_tripleclick_setvalue.html (861B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <title>Test for TextEditor triple click and SetValue</title> 4 <script src="/tests/SimpleTest/SimpleTest.js"></script> 5 <script src="/tests/SimpleTest/EventUtils.js"></script> 6 <style> 7 body { 8 font: 1em/1 Ahem 9 } 10 </style> 11 <input id="input" value="foo bar baz"> 12 <script> 13 SimpleTest.waitForExplicitFinish(); 14 SimpleTest.waitForFocus(() => { 15 const { input } = document.all; 16 input.focus(); 17 synthesizeMouse(input, 5, 5, { clickCount: 3 }, window); 18 is(input.selectionStart, 0, "selectionStart should be 0"); 19 is(input.selectionEnd, input.value.length, "selectionEnd should be the end of the value"); 20 synthesizeKey("KEY_Backspace"); 21 is(input.value, "", ".value should be empty"); 22 23 input.value = "hmm"; 24 is(input.value, "hmm", ".value must be set"); 25 SimpleTest.finish(); 26 }); 27 </script>