Chromium Code Reviews| 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'); | |
|
yosin_UTC9
2016/09/02 04:14:10
Could you utilize |selection.setClipboardData()|?
joone
2016/09/02 07:32:50
It doesn't work with this function because we only
yosin_UTC9
2016/09/05 01:42:22
assert_selection(
'<div style="width: 2em;"><b><
| |
| 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'); | |
| 30 | |
| 31 test(() => assert_selection( | |
| 32 '<div style="width: 2em;">^작은홍띠점박이푸른부전나비|</div><div contenteditable id="editor "></div>', | |
| 33 selection => { | |
| 34 var copy = selection.document.getElementById('copy'); | |
| 35 var editor = selection.document.getElementById('editor'); | |
| 36 | |
| 37 selection.document.execCommand('copy'); | |
| 38 selection.collapse(editor); | |
| 39 selection.document.execCommand('paste'); | |
| 40 }, | |
| 41 '<div style="width: 2em;">작은홍띠점박이푸른부전나비</div><div contenteditable id="editor">작 은홍띠점박이푸른부전나비|</div>'), | |
| 42 '3. Space should not be added for CJK'); | |
| 43 | |
| 44 test(() => assert_selection( | |
| 45 '<div style="width: 2em; word-break: break-all">^Pneumonoultramicroscopicsilic ovolcanoconiosis|</div><div contenteditable id="editor"></div>', | |
| 46 selection => { | |
| 47 var copy = selection.document.getElementById('copy'); | |
| 48 var editor = selection.document.getElementById('editor'); | |
| 49 | |
| 50 selection.document.execCommand('copy'); | |
| 51 selection.collapse(editor); | |
| 52 selection.document.execCommand('paste'); | |
| 53 }, | |
| 54 '<div style="width: 2em; word-break: break-all">Pneumonoultramicroscopicsilicov olcanoconiosis</div><div contenteditable id="editor">Pneumonoultramicroscopicsil icovolcanoconiosis|</div>'), | |
| 55 '4. Space should not be added for CSS word-break: break-all'); | |
| 17 </script> | 56 </script> |
| OLD | NEW |