Chromium Code Reviews| 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">Tests bold/italic style toggling on a content that has text node without renderer (Ex: Tab/Space used for indentation)</p> | 4 <script src="../assert_selection.js"></script> |
| 5 <div contenteditable id="root"> | |
| 6 <div id="test"> | |
| 7 <div>Some text</div> | |
| 8 <p>Some more text</p> | |
| 9 </div> | |
| 10 </div> | |
| 11 <script src=../editing.js language="JavaScript" type="text/JavaScript" ></script > | |
| 12 <script> | 5 <script> |
| 13 test('mac'); | 6 test(() => assert_selection( |
| 14 test('win'); | 7 [ |
| 15 test('unix'); | 8 '<div contenteditable>', |
| 16 function test(platform) { | 9 '<div>^abc def</div>', |
| 17 if (window.internals) | 10 '<p>ghi jkl|</p>', |
| 18 internals.settings.setEditingBehavior(platform); | 11 '</div>', |
| 19 startNewMarkupGroup('Test for '+platform); | 12 ].join(''), |
|
Xiaocheng
2016/10/27 01:54:59
I think we should have newlines and indentation in
| |
| 20 runDumpAsTextEditingTest(true); | 13 'bold', |
| 21 } | 14 [ |
| 22 function editingTest() { | 15 '<div contenteditable>', |
| 23 execSelectAllCommand(); | 16 '<div><b>^abc def</b></div>', |
| 24 execBoldCommand(); | 17 '<p><b>ghi jkl|</b></p>', |
| 25 execItalicCommand(); | 18 '</div>', |
| 26 execBoldCommand(); | 19 ].join('')), |
| 27 execItalicCommand(); | 20 'bold'); |
| 28 } | 21 |
| 22 test(() => assert_selection( | |
| 23 [ | |
| 24 '<div contenteditable>', | |
| 25 '<div>^abc def</div>', | |
| 26 '<p>ghi jkl|</p>', | |
| 27 '</div>', | |
| 28 ].join(''), | |
| 29 selection => { | |
| 30 selection.document.execCommand('bold'); | |
| 31 selection.document.execCommand('italic'); | |
| 32 }, | |
| 33 [ | |
| 34 '<div contenteditable>', | |
| 35 '<div><b><i>^abc def</i></b></div>', | |
| 36 '<p><b><i>ghi jkl|</i></b></p>', | |
| 37 '</div>', | |
| 38 ].join('')), | |
| 39 'bold+italic'); | |
| 40 | |
| 41 test(() => assert_selection( | |
| 42 [ | |
| 43 '<div contenteditable>', | |
| 44 '<div>^abc def</div>', | |
| 45 '<p>ghi jkl|</p>', | |
| 46 '</div>', | |
| 47 ].join(''), | |
| 48 selection => { | |
| 49 selection.document.execCommand('bold'); | |
| 50 selection.document.execCommand('italic'); | |
| 51 selection.document.execCommand('bold'); | |
| 52 }, | |
| 53 [ | |
| 54 '<div contenteditable>', | |
| 55 '<div><i>^abc def</i></div>', | |
| 56 '<p><i>ghi jkl|</i></p>', | |
| 57 '</div>', | |
| 58 ].join('')), | |
| 59 'bold+italic+bold'); | |
| 60 | |
| 61 test(() => assert_selection( | |
| 62 [ | |
| 63 '<div contenteditable>', | |
| 64 '<div>^abc def</div>', | |
| 65 '<p>ghi jkl|</p>', | |
| 66 '</div>', | |
| 67 ].join(''), | |
| 68 selection => { | |
| 69 selection.document.execCommand('bold'); | |
| 70 selection.document.execCommand('italic'); | |
| 71 selection.document.execCommand('bold'); | |
| 72 selection.document.execCommand('italic'); | |
| 73 }, | |
| 74 [ | |
| 75 '<div contenteditable>', | |
| 76 '<div>^abc def</div>', | |
| 77 '<p>ghi jkl|</p>', | |
| 78 '</div>', | |
| 79 ].join('')), | |
| 80 'bold+italic+bold+italic'); | |
| 29 </script> | 81 </script> |
| 30 </body> | |
| 31 </html> | |
| OLD | NEW |