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 pasteCommand(); | |
22 } | |
23 | |
24 </script> | |
25 | |
26 <title>Editing Test</title> | |
27 </head> | |
28 <body contenteditable id="root"> | |
29 | |
30 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). |
31 Should see one box with blockquoted "foo" text, followed by another box with an
"x" (not in a blockquote) and "foo" (in a blockquote). | 5 Should see one box with blockquoted "foo" text, followed by another box with an
"x" (not in a blockquote) and "foo" (in a blockquote). |
32 <div style="height: 24px"></div> | |
33 | 6 |
34 <div id="test" class="editing"><div><blockquote class="Apple-paste-as-quotation"
>foo</blockquote></div></div> | 7 <div id="sample" contenteditable><div><blockquote class="Apple-paste-as-quotatio
n">foo</blockquote></div></div> |
35 <div class="editing"></div> | 8 <div id="log"></div> |
36 | |
37 <script> | 9 <script> |
38 runEditingTest(); | 10 test(function() { |
| 11 var selection = window.getSelection(); |
| 12 var sample = document.getElementById('sample'); |
| 13 |
| 14 selection.collapse(sample, 0); |
| 15 for (i = 0; i < 4; i++) |
| 16 selection.modify('extend', 'forward', 'character'); |
| 17 document.execCommand('copy'); |
| 18 selection.modify('move', 'forward', 'character'); |
| 19 document.execCommand('insertText', false, 'x'); |
| 20 document.execCommand('paste'); |
| 21 |
| 22 assert_equals(sample.innerHTML, '<div><blockquote>fooxfoo</blockquote></div>
'); |
| 23 assert_true(selection.isCollapsed); |
| 24 assert_equals(selection.anchorNode, sample.querySelector('blockquote').first
Child); |
| 25 assert_equals(selection.anchorOffset, 7); |
| 26 }); |
39 </script> | 27 </script> |
40 | |
41 </body> | |
42 </html> | |
OLD | NEW |