| OLD | NEW |
| 1 <!doctype HTML> | 1 <!doctype HTML> |
| 2 <script src="../../resources/testharness.js"></script> | 2 <script src="../../resources/testharness.js"></script> |
| 3 <script src="../../resources/testharnessreport.js"></script> | 3 <script src="../../resources/testharnessreport.js"></script> |
| 4 <style> | 4 <style> |
| 5 #textarea, #plaintext, #richedit { | 5 #textarea, #plaintext, #richedit { |
| 6 font-family: 'Courier', monospace; | 6 font-family: 'Courier', monospace; |
| 7 width: 10ch; | 7 width: 10ch; |
| 8 } | 8 } |
| 9 #plaintext, #richedit { | 9 #plaintext, #richedit { |
| 10 border: 1px solid black; | 10 border: 1px solid black; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 let textarea = document.getElementById('textarea'); | 27 let textarea = document.getElementById('textarea'); |
| 28 textarea.focus(); | 28 textarea.focus(); |
| 29 textarea.setSelectionRange(10, 10); | 29 textarea.setSelectionRange(10, 10); |
| 30 eventSender.keyDown(' '); | 30 eventSender.keyDown(' '); |
| 31 assert_equals(textarea.value, '12345 \n 67', 'Line break should be inser
ted automatically'); | 31 assert_equals(textarea.value, '12345 \n 67', 'Line break should be inser
ted automatically'); |
| 32 }, 'Typing space at the start of wrapped line in textarea'); | 32 }, 'Typing space at the start of wrapped line in textarea'); |
| 33 | 33 |
| 34 test(function () { | 34 test(function () { |
| 35 let editor = document.getElementById('plaintext'); | 35 let editor = document.getElementById('plaintext'); |
| 36 let textNode = editor.firstChild; | 36 let textNode = editor.firstChild; |
| 37 editor.focus(); |
| 37 window.getSelection().setBaseAndExtent(textNode, 10, textNode, 10); | 38 window.getSelection().setBaseAndExtent(textNode, 10, textNode, 10); |
| 38 eventSender.keyDown(' '); | 39 eventSender.keyDown(' '); |
| 39 assert_equals(editor.textContent, '12345 \n 67', 'Line break should be i
nserted automatically'); | 40 assert_equals(editor.textContent, '12345 \n 67', 'Line break should be i
nserted automatically'); |
| 40 }, 'Typing space at the start of wrapped line in plaintext-only'); | 41 }, 'Typing space at the start of wrapped line in plaintext-only'); |
| 41 | 42 |
| 42 test(function () { | 43 test(function () { |
| 43 let editor = document.getElementById('richedit'); | 44 let editor = document.getElementById('richedit'); |
| 44 let textNode = editor.firstChild; | 45 let textNode = editor.firstChild; |
| 46 editor.focus(); |
| 45 window.getSelection().setBaseAndExtent(textNode, 10, textNode, 10); | 47 window.getSelection().setBaseAndExtent(textNode, 10, textNode, 10); |
| 46 eventSender.keyDown(' '); | 48 eventSender.keyDown(' '); |
| 47 assert_equals(editor.textContent, '12345 67', 'Line break should NOT be
inserted automatically'); | 49 assert_equals(editor.textContent, '12345 67', 'Line break should NOT be
inserted automatically'); |
| 48 }, 'Typing space at the start of wrapped line in contenteditable'); | 50 }, 'Typing space at the start of wrapped line in contenteditable'); |
| 49 })(); | 51 })(); |
| 50 </script> | 52 </script> |
| OLD | NEW |