| <!doctype html> |
| <script src="../../resources/testharness.js"></script> |
| <script src="../../resources/testharnessreport.js"></script> |
| <script src="../assert_selection.js"></script> |
| <script> |
| test(() => assert_selection( |
| [ |
| '<div contenteditable>', |
| '^abc <span contenteditable="false">def</span> ghi|', |
| '</div>', |
| ].join(''), |
| 'bold', |
| [ |
| '<div contenteditable>', |
| '<b>^abc </b><span contenteditable="false">def</span><b> ghi|</b>', |
| '</div>', |
| ].join('')), |
| 'bold'); |
| |
| test(() => assert_selection( |
| [ |
| '<div contenteditable>', |
| '^abc <span contenteditable="false">def</span> ghi|', |
| '</div>', |
| ].join(''), |
| selection => { |
| selection.document.execCommand('bold'); |
| selection.document.execCommand('italic'); |
| }, |
| [ |
| '<div contenteditable>', |
| '<b><i>^abc </i></b>', |
| '<span contenteditable="false">def</span>', |
| '<b><i> ghi|</i></b>', |
| '</div>', |
| ].join('')), |
| 'bold+italic'); |
| |
| test(() => assert_selection( |
| [ |
| '<div contenteditable>', |
| '^abc <span contenteditable="false">def</span> ghi|', |
| '</div>', |
| ].join(''), |
| selection => { |
| selection.document.execCommand('bold'); |
| selection.document.execCommand('italic'); |
| selection.document.execCommand('bold'); |
| }, |
| [ |
| '<div contenteditable>', |
| '<i style>^abc </i>', |
| '<span contenteditable="false">def</span>', |
| '<i style> ghi|</i>', |
| '</div>', |
| ].join('')), |
| 'bold+italic+bold'); |
| |
| test(() => assert_selection( |
| [ |
| '<div contenteditable>', |
| '^abc <span contenteditable="false">def</span> ghi|', |
| '</div>', |
| ].join(''), |
| selection => { |
| selection.document.execCommand('bold'); |
| selection.document.execCommand('italic'); |
| selection.document.execCommand('bold'); |
| selection.document.execCommand('italic'); |
| }, |
| [ |
| '<div contenteditable>', |
| '^abc <span contenteditable="false">def</span> ghi|', |
| '</div>', |
| ].join('')), |
| 'bold+italic+bold+italic'); |
| </script> |