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 <script src="../assert_selection.js"></script> | 4 <script src="../assert_selection.js"></script> |
5 <script> | 5 <script> |
6 test(() => assert_selection( | 6 test(() => assert_selection( |
7 '<div id="copy" style="width: 10em;">^Copy this area <a href="http://foo/">AVe
ryLongWordThatWillWrap|</a></div><div contenteditable id="editor"></div>', | 7 '<div id="copy" style="width: 10em;">^Copy this area <a href="http://foo/">AVe
ryLongWordThatWillWrap|</a></div><div contenteditable id="editor"></div>', |
8 selection => { | 8 selection => { |
9 var editor = selection.document.getElementById('editor'); | 9 var editor = selection.document.getElementById('editor'); |
10 | 10 |
11 selection.document.execCommand('copy'); | 11 selection.document.execCommand('copy'); |
12 selection.collapse(editor); | 12 selection.collapse(editor); |
13 selection.document.execCommand('paste'); | 13 selection.document.execCommand('paste'); |
14 }, | 14 }, |
15 '<div id="copy" style="width: 10em;">Copy this area <a href="http://foo/">AVer
yLongWordThatWillWrap</a></div><div contenteditable id="editor">Copy this area\u
00A0<a href="http://foo/">AVeryLongWordThatWillWrap|</a></div>'), | 15 '<div id="copy" style="width: 10em;">Copy this area <a href="http://foo/">AVer
yLongWordThatWillWrap</a></div><div contenteditable id="editor">Copy this area\u
00A0<a href="http://foo/">AVeryLongWordThatWillWrap|</a></div>'), |
16 'Restore the collapsed space'); | 16 '1. Restore the collapsed space'); |
| 17 |
| 18 test(() => assert_selection( |
| 19 '<div style="width: 2em;"><b><i>^foo </i></b>bar|</div><div contenteditable id
="editor"></div>', |
| 20 selection => { |
| 21 var copy = selection.document.getElementById('copy'); |
| 22 var editor = selection.document.getElementById('editor'); |
| 23 |
| 24 selection.document.execCommand('copy'); |
| 25 selection.collapse(editor); |
| 26 selection.document.execCommand('paste'); |
| 27 }, |
| 28 '<div style="width: 2em;"><b><i>foo </i></b>bar</div><div contenteditable id="e
ditor"><b><i>foo\u00A0</i></b>bar|</div>'), |
| 29 '2. Restore the collapsed space'); |
17 </script> | 30 </script> |
OLD | NEW |