| <!DOCTYPE html> |
| <script src="../../resources/testharness.js"></script> |
| <script src="../../resources/testharnessreport.js"></script> |
| This test ensures that createMarkup puts an interchange newline on the |
| pasteboard for a selection ending at the end of a block. |
| |
| <div id="copy" contenteditable="true"><div><div>foo</div>bar</div>baz</div> |
| <div id="sample" contenteditable="true">foo</div> |
| <div id="log"></div> |
| <script> |
| test(function() { |
| if (window.internals) |
| internals.settings.setEditingBehavior('win'); |
| |
| var selection = window.getSelection(); |
| selection.collapse(document.getElementById('copy'), 0); |
| selection.modify('move', 'forward', 'word'); |
| selection.modify('extend', 'forward', 'line'); |
| selection.modify('extend', 'forward', 'line'); |
| document.execCommand('copy'); |
| |
| var sample = document.getElementById('sample'); |
| selection.collapse(sample, 0); |
| selection.modify('move', 'forward', 'word'); |
| document.execCommand('paste'); |
| |
| assert_equals(sample.innerHTML, 'foobar<br>baz'); |
| assert_true(selection.isCollapsed); |
| assert_equals(selection.anchorNode, sample.lastChild); |
| assert_equals(selection.anchorOffset, 3); |
| }); |
| </script> |