| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <title>InputEvent: execCommand test</title> | 4 <title>InputEvent: execCommand test</title> |
| 5 <script src="../../../resources/testharness.js"></script> | 5 <script src="../../../resources/testharness.js"></script> |
| 6 <script src="../../../resources/testharnessreport.js"></script> | 6 <script src="../../../resources/testharnessreport.js"></script> |
| 7 </head> | 7 </head> |
| 8 <body> | 8 <body> |
| 9 <p id="txt" contenteditable></p> | 9 <p id="txt" contenteditable></p> |
| 10 <script> | 10 <script> |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 testExecCommandInputType('insertUnorderedList', null, 'insertUnorderedList')
; | 42 testExecCommandInputType('insertUnorderedList', null, 'insertUnorderedList')
; |
| 43 assert_equals(txt.innerHTML, '<ul><li>abc<br></li></ul>'); | 43 assert_equals(txt.innerHTML, '<ul><li>abc<br></li></ul>'); |
| 44 testExecCommandInputType('insertLineBreak', null, 'insertLineBreak'); | 44 testExecCommandInputType('insertLineBreak', null, 'insertLineBreak'); |
| 45 testExecCommandInputType('insertParagraph', null, 'insertParagraph'); | 45 testExecCommandInputType('insertParagraph', null, 'insertParagraph'); |
| 46 | 46 |
| 47 // Styling | 47 // Styling |
| 48 txt.innerHTML = 'abc'; | 48 txt.innerHTML = 'abc'; |
| 49 var selection = window.getSelection(); | 49 var selection = window.getSelection(); |
| 50 selection.collapse(txt, 0); | 50 selection.collapse(txt, 0); |
| 51 selection.extend(txt, 1); | 51 selection.extend(txt, 1); |
| 52 testExecCommandInputType('bold', null, 'bold'); | 52 testExecCommandInputType('bold', null, 'formatBold'); |
| 53 assert_equals(txt.innerHTML, '<b>abc</b>'); | 53 assert_equals(txt.innerHTML, '<b>abc</b>'); |
| 54 testExecCommandInputType('italic', null, 'italic'); | 54 testExecCommandInputType('italic', null, 'formatItalic'); |
| 55 assert_equals(txt.innerHTML, '<b><i>abc</i></b>'); | 55 assert_equals(txt.innerHTML, '<b><i>abc</i></b>'); |
| 56 testExecCommandInputType('underline', null, 'underline'); | 56 testExecCommandInputType('underline', null, 'formatUnderline'); |
| 57 assert_equals(txt.innerHTML, '<b><i><u>abc</u></i></b>'); | 57 assert_equals(txt.innerHTML, '<b><i><u>abc</u></i></b>'); |
| 58 testExecCommandInputType('strikeThrough', null, 'strikeThrough'); | 58 testExecCommandInputType('strikeThrough', null, 'formatStrikeThrough'); |
| 59 assert_equals(txt.innerHTML, '<b><i><u><strike>abc</strike></u></i></b>'); | 59 assert_equals(txt.innerHTML, '<b><i><u><strike>abc</strike></u></i></b>'); |
| 60 testExecCommandInputType('superscript', null, 'superscript'); | 60 testExecCommandInputType('superscript', null, 'formatSuperscript'); |
| 61 assert_equals(txt.innerHTML, '<b><i><u><strike><sup>abc</sup></strike></u></
i></b>'); | 61 assert_equals(txt.innerHTML, '<b><i><u><strike><sup>abc</sup></strike></u></
i></b>'); |
| 62 testExecCommandInputType('subscript', null, 'subscript'); | 62 testExecCommandInputType('subscript', null, 'formatSubscript'); |
| 63 assert_equals(txt.innerHTML, '<b><i><u><strike><sub>abc</sub></strike></u></
i></b>'); | 63 assert_equals(txt.innerHTML, '<b><i><u><strike><sub>abc</sub></strike></u></
i></b>'); |
| 64 | 64 |
| 65 // Formating | 65 // Formating |
| 66 txt.innerHTML = 'abc'; | 66 txt.innerHTML = 'abc'; |
| 67 testExecCommandInputType('justifyCenter', null, 'justifyCenter'); | 67 testExecCommandInputType('justifyCenter', null, 'formatJustifyCenter'); |
| 68 assert_equals(txt.innerHTML, '<div style="text-align: center;">abc</div>'); | 68 assert_equals(txt.innerHTML, '<div style="text-align: center;">abc</div>'); |
| 69 testExecCommandInputType('justifyFull', null, 'justifyFull'); | 69 testExecCommandInputType('justifyFull', null, 'formatJustifyFull'); |
| 70 assert_equals(txt.innerHTML, '<div style="text-align: justify;">abc</div>'); | 70 assert_equals(txt.innerHTML, '<div style="text-align: justify;">abc</div>'); |
| 71 testExecCommandInputType('justifyRight', null, 'justifyRight'); | 71 testExecCommandInputType('justifyRight', null, 'formatJustifyRight'); |
| 72 assert_equals(txt.innerHTML, '<div style="text-align: right;">abc</div>'); | 72 assert_equals(txt.innerHTML, '<div style="text-align: right;">abc</div>'); |
| 73 testExecCommandInputType('justifyLeft', null, 'justifyLeft'); | 73 testExecCommandInputType('justifyLeft', null, 'formatJustifyLeft'); |
| 74 assert_equals(txt.innerHTML, '<div style="text-align: left;">abc</div>'); | 74 assert_equals(txt.innerHTML, '<div style="text-align: left;">abc</div>'); |
| 75 selection.collapse(txt, 0); | 75 selection.collapse(txt, 0); |
| 76 selection.extend(txt, 1); | 76 selection.extend(txt, 1); |
| 77 testExecCommandInputType('removeFormat', null, 'removeFormat'); | 77 testExecCommandInputType('removeFormat', null, 'formatRemove'); |
| 78 assert_equals(txt.innerHTML, '<div>abc</div>'); | 78 assert_equals(txt.innerHTML, '<div>abc</div>'); |
| 79 testExecCommandInputType('indent', null, 'indent'); | 79 testExecCommandInputType('indent', null, 'formatIndent'); |
| 80 testExecCommandInputType('outdent', null, 'outdent'); | 80 testExecCommandInputType('outdent', null, 'formatOutdent'); |
| 81 assert_equals(txt.innerHTML, '<div>abc</div>'); | 81 assert_equals(txt.innerHTML, '<div>abc</div>'); |
| 82 | 82 |
| 83 // Copy shouldn't fire 'input'. | 83 // Copy shouldn't fire 'input'. |
| 84 testExecCommandInputType('copy', null, NO_INPUT_EVENT_FIRED); | 84 testExecCommandInputType('copy', null, NO_INPUT_EVENT_FIRED); |
| 85 // Cut/Paste should fire 'input'. | 85 // Cut/Paste should fire 'input'. |
| 86 testExecCommandInputType('cut', null, 'deleteByCut'); | 86 testExecCommandInputType('cut', null, 'deleteByCut'); |
| 87 testExecCommandInputType('paste', null, 'insertFromPaste'); | 87 testExecCommandInputType('paste', null, 'insertFromPaste'); |
| 88 }, 'Testing input with execCommand'); | 88 }, 'Testing input with execCommand'); |
| 89 </script> | 89 </script> |
| 90 </body> | 90 </body> |
| 91 </html> | 91 </html> |
| OLD | NEW |