OLD | NEW |
| 1 <!DOCTYPE html> |
| 2 <script src="../../resources/testharness.js"></script> |
| 3 <script src="../../resources/testharnessreport.js"></script> |
| 4 <p>There was a bug in paste's smart replace whitespace handling. In some cases, |
| 5 it used information gathered at the start of the selection being pasted into to |
| 6 decide whether or not a space needed to be added to the end of the incoming |
| 7 content.</p> |
| 8 <p>A smart paste is performed into a selection starting in one block and ending |
| 9 in another. Spaces should surround the pasted word.</p> |
| 10 <div id="sample" contenteditable="true"><div id="foo">foo</div><div id="bar">x b
ar</div></div> |
| 11 <div id="log"></div> |
1 <script> | 12 <script> |
2 if (window.testRunner) | 13 test(function() { |
3 testRunner.dumpEditingCallbacks(); | 14 var selection = window.getSelection(); |
| 15 var sample = document.getElementById('sample'); |
| 16 |
| 17 if (!window.internals && !window.eventSender) |
| 18 return; |
| 19 |
| 20 internals.settings.setEditingBehavior('win'); |
| 21 |
| 22 selection.setBaseAndExtent(sample, 0, sample, 0); |
| 23 var rects = window.getSelection().getRangeAt(0).getClientRects(); |
| 24 var x = rects[0].left; |
| 25 var y = rects[0].top; |
| 26 eventSender.mouseMoveTo(x, y); |
| 27 eventSender.mouseDown(); |
| 28 eventSender.mouseUp(); |
| 29 eventSender.mouseDown(); |
| 30 eventSender.mouseUp(); |
| 31 document.execCommand('copy'); |
| 32 |
| 33 selection.collapse(document.getElementById('foo').firstChild, 1); |
| 34 selection.extend(document.getElementById('bar').firstChild, 1); |
| 35 document.execCommand('paste'); |
| 36 |
| 37 assert_equals(sample.innerHTML, '<div id="foo">f foo bar</div>', 'innerHTML'
); |
| 38 assert_true(selection.isCollapsed, 'isCollapsed'); |
| 39 assert_equals(selection.anchorNode, document.getElementById('foo').firstChil
d, 'anchorNode'); |
| 40 assert_equals(selection.anchorOffset, 5, 'anchorOffset'); |
| 41 }); |
4 </script> | 42 </script> |
5 <p>There was a bug in paste's smart replace whitespace handling. In some cases,
it used information gathered at the start of the selection being pasted into to
decide whether or not a space needed to be added to the end of the incoming con
tent.</p> | |
6 <p>A smart paste is performed into a selection starting in one block and ending
in another. Spaces should surround the pasted word.</p> | |
7 <div id="test" contenteditable="true"><div>foo</div><div>x bar</div></div> | |
8 | |
9 <script type="text/javascript" src="../editing.js"></script> | |
10 <script> | |
11 var s = window.getSelection(); | |
12 var e = document.getElementById("test"); | |
13 | |
14 setSelectionCommand(e, 0, e, 0); | |
15 doubleClickAtSelectionStart(); | |
16 copyCommand(); | |
17 moveSelectionBackwardByCharacterCommand(); | |
18 moveSelectionForwardByCharacterCommand(); | |
19 extendSelectionForwardByLineCommand(); | |
20 pasteCommand(); | |
21 </script> | |
OLD | NEW |