OLD | NEW |
| 1 <!doctype html> |
| 2 <script src="../../resources/testharness.js"></script> |
| 3 <script src="../../resources/testharnessreport.js"></script> |
| 4 <script src="../assert_selection.js"></script> |
| 5 <script> |
| 6 test(() => assert_selection( |
| 7 '<div contenteditable>Foo | <i> bar</i></div>', |
| 8 selection => { |
| 9 selection.document.execCommand('insertText', false, 'x'); |
| 10 selection.document.execCommand('insertText', false, 'x'); |
| 11 selection.document.execCommand('insertText', false, 'x'); |
| 12 }, |
| 13 '<div contenteditable>Foo xxx|<i>bar</i></div>'), |
| 14 'Collapse spaces'); |
1 | 15 |
2 <html> | 16 test(() => assert_selection( |
3 <head> | 17 '<div contenteditable>Foo <i> bar</i>\n\n|baz</div>', |
| 18 selection => { |
| 19 selection.document.execCommand('insertText', false, 'x'); |
| 20 selection.document.execCommand('insertText', false, 'x'); |
| 21 selection.document.execCommand('insertText', false, 'x'); |
| 22 }, |
| 23 '<div contenteditable>Foo <i> bar</i>\u{00A0}xxx|baz</div>'), |
| 24 'Replace newlines into nbsp'); |
4 | 25 |
5 <style> | 26 test(() => assert_selection( |
6 .editing { | 27 '<div contenteditable>foo|bar</div>', |
7 border: 2px solid red; | 28 selection => { |
8 padding: 12px; | 29 selection.document.execCommand('insertLineBreak'); |
9 font-size: 24px; | 30 selection.document.execCommand('insertLineBreak'); |
10 } | 31 }, |
11 </style> | 32 '<div contenteditable>foo<br><br>|bar</div>'), |
12 <script src=../editing.js language="JavaScript" type="text/JavaScript" ></script
> | 33 'Insert BRs'); |
13 | |
14 <script> | |
15 | |
16 function moveNSpacesAndType(n) { | |
17 for (i = 0; i < n; i++) { | |
18 moveSelectionForwardByCharacterCommand(); | |
19 } | |
20 for (i = 0; i < 3; i++) { | |
21 typeCharacterCommand(); | |
22 } | |
23 } | |
24 | |
25 function editingTest() { | |
26 moveNSpacesAndType(4); | |
27 insertLineBreakCommand(); | |
28 moveNSpacesAndType(4); | |
29 insertLineBreakCommand(); | |
30 insertLineBreakCommand(); | |
31 moveNSpacesAndType(4); | |
32 } | |
33 | |
34 </script> | 34 </script> |
35 | |
36 <title>Editing Test</title> | |
37 </head> | |
38 <body> | |
39 <div contenteditable id="root" class="editing"> | |
40 <span id="test">Foo <i> bar</i> | |
41 | |
42 baz</span> | |
43 </div> | |
44 | |
45 <script> | |
46 runEditingTest(); | |
47 </script> | |
48 | |
49 </body> | |
50 </html> | |
OLD | NEW |