| OLD | NEW |
| 1 <html> | 1 <!DOCTYPE html> |
| 2 <head> | 2 <script src="../../resources/testharness.js"></script> |
| 3 | 3 <script src="../../resources/testharnessreport.js"></script> |
| 4 <style> | |
| 5 .editing { | |
| 6 border: 2px solid red; | |
| 7 padding: 12px; | |
| 8 font-size: 24px; | |
| 9 } | |
| 10 </style> | |
| 11 <script src=../editing.js language="JavaScript" type="text/JavaScript" ></script
> | |
| 12 | |
| 13 <script> | |
| 14 | |
| 15 function editingTest() { | |
| 16 for (i = 0; i < 4; i++) | |
| 17 extendSelectionForwardByCharacterCommand(); | |
| 18 copyCommand(); | |
| 19 moveSelectionForwardByCharacterCommand(); | |
| 20 typeCharacterCommand(); | |
| 21 moveSelectionBackwardByCharacterCommand(); | |
| 22 pasteCommand(); | |
| 23 } | |
| 24 | |
| 25 </script> | |
| 26 | |
| 27 <title>Editing Test</title> | |
| 28 </head> | |
| 29 <body contenteditable id="root"> | |
| 30 | |
| 31 See this bug: <a href="rdar://problem/3918712"><rdar://problem/3918712></a
> "Paste as Quotation" in Mail just pastes (<blockquote> tag seems to be l
ost). | 4 See this bug: <a href="rdar://problem/3918712"><rdar://problem/3918712></a
> "Paste as Quotation" in Mail just pastes (<blockquote> tag seems to be l
ost). |
| 32 Should see two boxes with blockquoted "foo" text, followed by a box with an unqu
oted "x". | 5 Should see two boxes with blockquoted "foo" text, followed by a box with an unqu
oted "x". |
| 33 <div style="height: 24px"></div> | |
| 34 | 6 |
| 35 <div id="test" class="editing"><div><blockquote>foo</blockquote></div></div> | 7 <div id="sample" contenteditable><div><blockquote>foo</blockquote></div></div> |
| 36 <div class="editing"></div> | 8 <div id="log"></div> |
| 37 | 9 |
| 38 <script> | 10 <script> |
| 39 runEditingTest(); | 11 test(function() { |
| 12 var selection = window.getSelection(); |
| 13 var sample = document.getElementById('sample'); |
| 14 |
| 15 selection.collapse(sample, 0); |
| 16 for (i = 0; i < 4; i++) |
| 17 selection.modify('extend', 'forward', 'character'); |
| 18 document.execCommand('copy'); |
| 19 selection.modify('move', 'forward', 'character'); |
| 20 document.execCommand('insertText', false, 'x'); |
| 21 selection.modify('move', 'backward', 'character'); |
| 22 document.execCommand('paste'); |
| 23 |
| 24 assert_equals(sample.innerHTML, '<blockquote>foofoox</blockquote>'); |
| 25 assert_true(selection.isCollapsed); |
| 26 assert_equals(selection.anchorNode, sample.querySelector('blockquote').first
Child); |
| 27 assert_equals(selection.anchorOffset, 6); |
| 28 }); |
| 40 </script> | 29 </script> |
| 41 | |
| 42 </body> | |
| 43 </html> | |
| OLD | NEW |