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 font-size: 24px; | |
8 } | |
9 .explanation { | |
10 border: 2px solid blue; | |
11 padding: 12px; | |
12 font-size: 24px; | |
13 margin-bottom: 24px; | |
14 } | |
15 .scenario { margin-bottom: 16px;} | |
16 .scenario:first-line { font-weight: bold; margin-bottom: 16px;} | |
17 .expected-results:first-line { font-weight: bold } | |
18 </style> | |
19 <script src=../editing.js language="JavaScript" type="text/JavaScript" ></script
> | |
20 | |
21 <script> | |
22 | |
23 function editingTest() { | |
24 extendSelectionForwardByLineCommand(); | |
25 boldCommand(); | |
26 moveSelectionForwardByCharacterCommand(); | |
27 insertParagraphCommand(); | |
28 boldCommand(); | |
29 typeCharacterCommand(); | |
30 moveSelectionBackwardByCharacterCommand(); | |
31 deleteCommand(); | |
32 } | |
33 | |
34 </script> | |
35 | |
36 <title>Editing Test</title> | |
37 </head> | |
38 <body> | |
39 | |
40 <div class="explanation"> | 4 <div class="explanation"> |
41 <div class="scenario"> | 5 <div class="scenario"> |
42 Tests: | 6 Tests: |
43 <br> | 7 <br> |
44 Inserting blocks for paragraphs should do a better job of finding a block to ins
ert after. | 8 Inserting blocks for paragraphs should do a better job of finding a block to ins
ert after. |
45 <a href="rdar://problem/3996605"><rdar://problem/3996605></a> Insert parag
raph command puts new block in wrong place, creating difficult-to-handle HTML | 9 <a href="rdar://problem/3996605"><rdar://problem/3996605></a> Insert parag
raph command puts new block in wrong place, creating difficult-to-handle HTML |
46 </div> | 10 </div> |
47 <div class="expected-results"> | 11 <div class="expected-results"> |
48 Expected Results: | 12 Expected Results: |
49 <br> | 13 <br> |
50 Should see this content in the red box below: <b>fo</b>x | 14 Should see this content in the red box below: <b>fo</b>x |
51 </div> | 15 </div> |
52 </div> | 16 </div> |
53 | 17 |
54 <div contenteditable id="root" style="word-wrap: break-word; -khtml-nbsp-mode: s
pace; -khtml-line-break: after-white-space;"> | 18 <div contenteditable id="root" style="word-wrap: break-word; -khtml-nbsp-mode: s
pace; -khtml-line-break: after-white-space;"> |
55 <div id="test" class="editing"> | 19 <div id="sample" class="editing">fo</div> |
56 fo | 20 <div id="log"></div> |
57 </div> | 21 <script> |
| 22 test(function() { |
| 23 var selection = window.getSelection(); |
| 24 var sample = document.getElementById('sample'); |
58 | 25 |
59 <script> | 26 selection.collapse(sample.firstChild, 0); |
60 runEditingTest(); | 27 selection.modify('extend', 'forward', 'line'); |
| 28 document.execCommand('bold'); |
| 29 selection.modify('move', 'forward', 'character'); |
| 30 document.execCommand('insertParagraph'); |
| 31 document.execCommand('bold'); |
| 32 document.execCommand('InsertText', false, 'x') |
| 33 selection.modify('move', 'backward', 'character'); |
| 34 document.execCommand('delete'); |
| 35 |
| 36 assert_equals(sample.innerHTML, '<b>fo</b>x'); |
| 37 }); |
61 </script> | 38 </script> |
62 | |
63 </body> | |
64 </html> | |
OLD | NEW |