OLD | NEW |
1 <!DOCTYPE html> | 1 <!doctype html> |
2 <html> | 2 <script src="../../resources/testharness.js"></script> |
3 <body> | 3 <script src="../../resources/testharnessreport.js"></script> |
4 <p id="description">This tests bold/italic style toggling for a content with mix
ed editability</p> | 4 <script src="../assert_selection.js"></script> |
5 <div contenteditable id="root"> | |
6 <div id="test"> | |
7 Editable <span contenteditable=false>Non-editable</span> Editable | |
8 </div> | |
9 </div> | |
10 <script src=../editing.js language="JavaScript" type="text/JavaScript" ></script
> | |
11 <script> | 5 <script> |
12 test('mac'); | 6 test(() => assert_selection( |
13 test('win'); | 7 [ |
14 test('unix'); | 8 '<div contenteditable>', |
15 function test(platform) { | 9 '^abc <span contenteditable="false">def</span> ghi|', |
16 if (window.internals) | 10 '</div>', |
17 internals.settings.setEditingBehavior(platform); | 11 ].join(''), |
18 startNewMarkupGroup('Test for '+platform); | 12 'bold', |
19 runDumpAsTextEditingTest(true); | 13 [ |
20 } | 14 '<div contenteditable>', |
21 function editingTest() { | 15 '<b>^abc </b><span contenteditable="false">def</span><b> ghi|</b>', |
22 execSelectAllCommand(); | 16 '</div>', |
23 execBoldCommand(); | 17 ].join('')), |
24 execItalicCommand(); | 18 'bold'); |
25 execBoldCommand(); | 19 |
26 execItalicCommand(); | 20 test(() => assert_selection( |
27 } | 21 [ |
| 22 '<div contenteditable>', |
| 23 '^abc <span contenteditable="false">def</span> ghi|', |
| 24 '</div>', |
| 25 ].join(''), |
| 26 selection => { |
| 27 selection.document.execCommand('bold'); |
| 28 selection.document.execCommand('italic'); |
| 29 }, |
| 30 [ |
| 31 '<div contenteditable>', |
| 32 '<b><i>^abc </i></b>', |
| 33 '<span contenteditable="false">def</span>', |
| 34 '<b><i> ghi|</i></b>', |
| 35 '</div>', |
| 36 ].join('')), |
| 37 'bold+italic'); |
| 38 |
| 39 test(() => assert_selection( |
| 40 [ |
| 41 '<div contenteditable>', |
| 42 '^abc <span contenteditable="false">def</span> ghi|', |
| 43 '</div>', |
| 44 ].join(''), |
| 45 selection => { |
| 46 selection.document.execCommand('bold'); |
| 47 selection.document.execCommand('italic'); |
| 48 selection.document.execCommand('bold'); |
| 49 }, |
| 50 [ |
| 51 '<div contenteditable>', |
| 52 '<i>^abc </i>', |
| 53 '<span contenteditable="false">def</span>', |
| 54 '<i> ghi|</i>', |
| 55 '</div>', |
| 56 ].join('')), |
| 57 'bold+italic+bold'); |
| 58 |
| 59 test(() => assert_selection( |
| 60 [ |
| 61 '<div contenteditable>', |
| 62 '^abc <span contenteditable="false">def</span> ghi|', |
| 63 '</div>', |
| 64 ].join(''), |
| 65 selection => { |
| 66 selection.document.execCommand('bold'); |
| 67 selection.document.execCommand('italic'); |
| 68 selection.document.execCommand('bold'); |
| 69 selection.document.execCommand('italic'); |
| 70 }, |
| 71 [ |
| 72 '<div contenteditable>', |
| 73 '^abc <span contenteditable="false">def</span> ghi|', |
| 74 '</div>', |
| 75 ].join('')), |
| 76 'bold+italic+bold+italic'); |
28 </script> | 77 </script> |
29 </body> | |
30 </html> | |
OLD | NEW |