OLD | NEW |
1 <script src=../editing.js language="JavaScript" type="text/JavaScript" ></script
> | 1 <!DOCTYPE html> |
| 2 <script src="../../resources/testharness.js"></script> |
| 3 <script src="../../resources/testharnessreport.js"></script> |
| 4 <p>This tests smart paste of a fragment that ends in a select element. |
| 5 There should be spaces added before and after the inserted content.</p> |
| 6 <div contenteditable="true" id="copy"><select><option>1</option><option>2</optio
n><option>3</option></select></div> |
| 7 <div contenteditable="true" id="sample">xx</div> |
| 8 <div id="log"></div> |
| 9 <script> |
| 10 test(function() { |
| 11 if (window.internals) |
| 12 internals.settings.setEditingBehavior('win'); |
2 | 13 |
3 <p>This tests smart paste of a fragment that ends in a select element. There sh
ould be spaces added before and after the inserted content.</p> | 14 var selection = window.getSelection(); |
4 <div contenteditable="true" id="copy"><select><option>1</option><option>2</optio
n><option>3</option></select></div> | 15 var sample= document.getElementById('sample'); |
5 <div contenteditable="true" id="paste">xx</div> | |
6 | 16 |
7 <script> | 17 selection.selectAllChildren(document.getElementById('copy')); |
8 var copy = document.getElementById("copy"); | 18 document.execCommand('copy'); |
9 doubleClick(copy.offsetLeft, copy.offsetTop); | |
10 document.execCommand("Copy"); | |
11 | 19 |
12 var paste = document.getElementById("paste"); | 20 selection.collapse(sample.firstChild, 1); |
13 var sel = window.getSelection(); | 21 document.execCommand('paste'); |
14 sel.collapse(paste, 0); | 22 |
15 sel.modify("move", "forward", "character"); | 23 assert_equals(sample.innerHTML, 'x<select><option>1</option><option>2</optio
n><option>3</option></select>x', 'innerHHTML'); |
16 document.execCommand("Paste"); | 24 assert_true(selection.isCollapsed); |
| 25 assert_equals(selection.anchorNode, sample); |
| 26 assert_equals(selection.anchorOffset, 2); |
| 27 }); |
17 </script> | 28 </script> |
OLD | NEW |