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 style="width: 10em;">Copy this area <a href="http://foo/">AVeryLongWordT
hatWillWrap</a></div><div contenteditable>|</div>', |
8 selection => { | 8 selection => { |
9 var editor = selection.document.getElementById('editor'); | 9 selection.setClipboardData('Copy this area <a href="http://foo/">AVeryLongWo
rdThatWillWrap</a>'); |
10 | |
11 selection.document.execCommand('copy'); | |
12 selection.collapse(editor); | |
13 selection.document.execCommand('paste'); | 10 selection.document.execCommand('paste'); |
14 }, | 11 }, |
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>'), | 12 '<div style="width: 10em;">Copy this area <a href="http://foo/">AVeryLongWordT
hatWillWrap</a></div><div contenteditable>Copy this area <a href="http://foo/">A
VeryLongWordThatWillWrap|</a></div>'), |
16 'Restore the collapsed space'); | 13 '1. Restore the collapsed space'); |
| 14 |
| 15 test(() => assert_selection( |
| 16 '<div style="width: 2em;"><b><i>foo </i></b>bar</div><div contenteditable>|</d
iv>', |
| 17 selection => { |
| 18 selection.setClipboardData('<b><i>foo </i></b>bar'); |
| 19 selection.document.execCommand('paste'); |
| 20 }, |
| 21 '<div style="width: 2em;"><b><i>foo </i></b>bar</div><div contenteditable><b><i
>foo </i></b>bar|</div>'), |
| 22 '2. Restore the collapsed space'); |
| 23 |
| 24 test(() => assert_selection( |
| 25 '<div style="width: 2em;">작은홍띠점박이푸른부전나비</div><div contenteditable>|</div>', |
| 26 selection => { |
| 27 selection.setClipboardData('작은홍띠점박이푸른부전나비'); |
| 28 selection.document.execCommand('paste'); |
| 29 }, |
| 30 '<div style="width: 2em;">작은홍띠점박이푸른부전나비</div><div contenteditable>작은홍띠점박이푸른부전나비
|</div>'), |
| 31 '3. Space should not be added for CJK'); |
| 32 |
| 33 test(() => assert_selection( |
| 34 '<div style="width: 2em; word-break: break-all">Pneumonoultramicroscopicsilico
volcanoconiosis</div><div contenteditable>|</div>', |
| 35 selection => { |
| 36 selection.setClipboardData('Pneumonoultramicroscopicsilicovolcanoconiosis'); |
| 37 selection.document.execCommand('paste'); |
| 38 }, |
| 39 '<div style="width: 2em; word-break: break-all">Pneumonoultramicroscopicsilicov
olcanoconiosis</div><div contenteditable>Pneumonoultramicroscopicsilicovolcanoco
niosis|</div>'), |
| 40 '4. Space should not be added for CSS word-break: break-all'); |
17 </script> | 41 </script> |
OLD | NEW |