OLD | NEW |
1 <!DOCTYPE html> | 1 <!doctype html> |
2 <html> | 2 <script src="../../resources/testharness.js"></script> |
3 <body> | 3 <script src="../../resources/testharnessreport.js"></script> |
4 <script src="../../resources/dump-as-markup.js"></script> | 4 <script src="../assert_selection.js"></script> |
| 5 <div id="log"></div> |
5 <script> | 6 <script> |
6 | 7 test(() => assert_selection( |
7 if (window.testRunner) | 8 [ |
8 testRunner.dumpEditingCallbacks(); | 9 '<div contenteditable>', |
9 | 10 '<a href="#">1|</a><div>3</div>', |
10 // Set up the div | 11 '</div>', |
11 var editable = document.createElement('div'); | 12 ].join(''), |
12 editable.contentEditable = true; | 13 selection => { |
13 editable.innerHTML = '<a href="#" id="anchor">1</a><div>3</div>'; | 14 selection.document.execCommand('insertParagraph'); |
14 document.body.appendChild(editable); | 15 selection.document.execCommand('insertText', false, '2'); |
15 editable.focus(); | 16 }, |
16 | 17 [ |
17 // Edit it with execCommand | 18 '<div contenteditable>', |
18 var sel = window.getSelection(); | 19 '<a href="#">1</a>', |
19 sel.collapse(document.getElementById('anchor'), 1); | 20 '<div>2|<br>', |
20 document.execCommand("InsertParagraph"); | 21 '<div>3</div>', |
21 document.execCommand("InsertText", false, "2"); | 22 '</div>', |
22 | 23 '</div>', |
23 Markup.description('This tests the fix for <rdar://problem/6633727> - Hitting re
turn at the end of a line with an anchor jumps me to the bottom of the message.\
n'+ | 24 ].join('')), |
24 'If the test has passed, the numbers should be in order, and only "1" should be
a link.'); | 25 'Simulate hitting return at the end of line'); |
25 Markup.dump(editable); | |
26 | |
27 </script> | 26 </script> |
28 </body> | |
29 </html> | |
OLD | NEW |