Changes from trunk/tests/qunit/editor/tinymce/EnterKey.js at r31700 to branches/4.3/tests/qunit/editor/tinymce/EnterKey.js at r34029
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/4.3/tests/qunit/editor/tinymce/EnterKey.js
r31700 r34029 14 14 extended_valid_elements: 'div[id|style|contenteditable],span[id|style|contenteditable],#dt,#dd', 15 15 valid_styles: { 16 '*' : 'color,font-size,font-family,background-color,font-weight,font-style,text-decoration,float,margin,margin-top,margin-right,margin-bottom,margin-left,display,position,top,left'16 '*' : 'color,font-size,font-family,background-color,font-weight,font-style,text-decoration,float,margin,margin-top,margin-right,margin-bottom,margin-left,display,position,top,left' 17 17 }, 18 18 init_instance_callback: function(ed) { … … 37 37 Utils.setSelection('h1', 3); 38 38 Utils.pressEnter(); 39 equal(editor.getContent(), '<h1>abc</h1><p>\u00a0</p>');39 equal(editor.getContent(), '<h1>abc</h1><p>\u00a0</p>'); 40 40 equal(editor.selection.getRng(true).startContainer.nodeName, 'P'); 41 41 }); … … 45 45 Utils.setSelection('h1', 2); 46 46 Utils.pressEnter(); 47 equal(editor.getContent(), '<h1>ab</h1><h1>cd</h1>');47 equal(editor.getContent(), '<h1>ab</h1><h1>cd</h1>'); 48 48 equal(editor.selection.getRng(true).startContainer.parentNode.nodeName, 'H1'); 49 49 }); … … 53 53 editor.selection.setCursorLocation(editor.getBody().firstChild, 1); 54 54 Utils.pressEnter(); 55 equal(editor.getContent(), '<p><em>a</em></p><p>b</p>');55 equal(editor.getContent(), '<p><em>a</em></p><p>b</p>'); 56 56 var rng = editor.selection.getRng(true); 57 57 equal(rng.startContainer.nodeValue, 'b'); … … 62 62 editor.selection.setCursorLocation(editor.getBody().firstChild, 0); 63 63 Utils.pressEnter(); 64 equal(editor.getContent(), '<p>\u00a0</p><p><img src="about:blank" alt="" /></p>');64 equal(editor.getContent(), '<p>\u00a0</p><p><img src="about:blank" alt="" /></p>'); 65 65 }); 66 66 … … 69 69 editor.selection.setCursorLocation(editor.getBody().firstChild, 1); 70 70 Utils.pressEnter(); 71 equal(editor.getContent(), '<p>abc</p><p><img src="about:blank" alt="" /></p>');71 equal(editor.getContent(), '<p>abc</p><p><img src="about:blank" alt="" /></p>'); 72 72 var rng = editor.selection.getRng(true); 73 73 equal(rng.startContainer.nodeName, 'P'); … … 79 79 editor.selection.setCursorLocation(editor.getBody().firstChild, 1); 80 80 Utils.pressEnter(); 81 equal(editor.getContent(), '<p><img src="about:blank" alt="" /></p><p><img src="about:blank" alt="" /></p>');81 equal(editor.getContent(), '<p><img src="about:blank" alt="" /></p><p><img src="about:blank" alt="" /></p>'); 82 82 var rng = editor.selection.getRng(true); 83 83 equal(rng.startContainer.nodeName, 'P'); … … 89 89 editor.selection.setCursorLocation(editor.getBody().firstChild, 2); 90 90 Utils.pressEnter(); 91 equal(editor.getContent(), '<p>abc<img src="about:blank" alt="" /></p><p>\u00a0</p>');91 equal(editor.getContent(), '<p>abc<img src="about:blank" alt="" /></p><p>\u00a0</p>'); 92 92 }); 93 93 … … 96 96 editor.selection.setCursorLocation(editor.getBody().firstChild, 1); 97 97 Utils.pressEnter(); 98 equal(editor.getContent(), '<p>abc</p><p><input type="text" /></p>');98 equal(editor.getContent(), '<p>abc</p><p><input type="text" /></p>'); 99 99 var rng = editor.selection.getRng(true); 100 100 equal(rng.startContainer.nodeName, 'P'); … … 106 106 editor.selection.setCursorLocation(editor.getBody().firstChild, 1); 107 107 Utils.pressEnter(); 108 equal(editor.getContent(), '<p><input type="text" /></p><p><input type="text" /></p>');108 equal(editor.getContent(), '<p><input type="text" /></p><p><input type="text" /></p>'); 109 109 var rng = editor.selection.getRng(true); 110 110 equal(rng.startContainer.nodeName, 'P'); … … 116 116 editor.selection.setCursorLocation(editor.getBody().firstChild, 2); 117 117 Utils.pressEnter(); 118 equal(editor.getContent(), '<p>abc<input type="text" /></p><p>\u00a0</p>');118 equal(editor.getContent(), '<p>abc<input type="text" /></p><p>\u00a0</p>'); 119 119 }); 120 120 … … 123 123 Utils.setSelection('p', 3); 124 124 Utils.pressEnter(); 125 equal(editor.getContent(), '<p>abc</p><p>\u00a0</p>');125 equal(editor.getContent(), '<p>abc</p><p>\u00a0</p>'); 126 126 equal(editor.selection.getRng(true).startContainer.nodeName, 'P'); 127 127 }); … … 139 139 Utils.setSelection('em', 2); 140 140 Utils.pressEnter(); 141 equal(editor.getContent(), '<p><em>ab</em></p><p><em>cd</em></p>');141 equal(editor.getContent(), '<p><em>ab</em></p><p><em>cd</em></p>'); 142 142 equal(editor.selection.getRng(true).startContainer.parentNode.nodeName, 'EM'); 143 143 }); … … 163 163 Utils.setSelection('strong', 2); 164 164 Utils.pressEnter(); 165 equal(editor.getContent(), '<p><em><strong>ab</strong></em></p><p><em><strong>cd</strong></em></p>');165 equal(editor.getContent(), '<p><em><strong>ab</strong></em></p><p><em><strong>cd</strong></em></p>'); 166 166 equal(editor.selection.getRng(true).startContainer.parentNode.nodeName, 'STRONG'); 167 167 }); … … 179 179 Utils.setSelection('p', 0); 180 180 Utils.pressEnter(); 181 equal(editor.getContent(), '<p>\u00a0</p><p>abc</p>');181 equal(editor.getContent(), '<p>\u00a0</p><p>abc</p>'); 182 182 equal(editor.selection.getRng(true).startContainer.nodeValue, 'abc'); 183 183 }); … … 187 187 Utils.setSelection('p', 2); 188 188 Utils.pressEnter(); 189 equal(editor.getContent(), '<p id="a" class="b" style="color: #000;">ab</p><p class="b" style="color: #000;">cd</p>');189 equal(editor.getContent(), '<p id="a" class="b" style="color: #000;">ab</p><p class="b" style="color: #000;">cd</p>'); 190 190 equal(editor.selection.getRng(true).startContainer.parentNode.nodeName, 'P'); 191 191 }); … … 195 195 Utils.setSelection('h1', 2, 'p', 2); 196 196 Utils.pressEnter(); 197 equal(editor.getContent(), '<h1>abgh</h1>');197 equal(editor.getContent(), '<h1>abgh</h1>'); 198 198 equal(editor.selection.getNode().nodeName, 'H1'); 199 199 }); … … 203 203 Utils.setSelection('h1', 3); 204 204 Utils.pressEnter(); 205 equal(editor.getContent(), '<hgroup><h1>abc</h1><h1>\u00a0</h1></hgroup>');205 equal(editor.getContent(), '<hgroup><h1>abc</h1><h1>\u00a0</h1></hgroup>'); 206 206 equal(editor.selection.getRng(true).startContainer.nodeName, 'H1'); 207 207 }); … … 227 227 Utils.setSelection('body', 2); 228 228 Utils.pressEnter(); 229 equal(editor.getContent(), '<p>ab</p><p>cd</p>');229 equal(editor.getContent(), '<p>ab</p><p>cd</p>'); 230 230 equal(editor.selection.getNode().nodeName, 'P'); 231 231 }); … … 235 235 Utils.setSelection('body', 0); 236 236 Utils.pressEnter(); 237 equal(editor.getContent(), '<p>\u00a0</p><p>abcd</p>');237 equal(editor.getContent(), '<p>\u00a0</p><p>abcd</p>'); 238 238 equal(editor.selection.getNode().nodeName, 'P'); 239 239 }); … … 243 243 Utils.setSelection('body', 4); 244 244 Utils.pressEnter(); 245 equal(editor.getContent(), '<p>abcd</p><p>\u00a0</p>');245 equal(editor.getContent(), '<p>abcd</p><p>\u00a0</p>'); 246 246 equal(editor.selection.getNode().nodeName, 'P'); 247 247 }); … … 251 251 Utils.setSelection('body', 0); 252 252 Utils.pressEnter(); 253 equal(editor.getContent(), '<p>\u00a0</p><p>\u00a0</p>');253 equal(editor.getContent(), '<p>\u00a0</p><p>\u00a0</p>'); 254 254 equal(editor.selection.getNode().nodeName, 'P'); 255 255 }); 256 256 257 257 test('Enter inside empty li in beginning of ol', function() { 258 editor.getBody().innerHTML = (tinymce.isIE && tinymce.Env.ie < 11) ? '<ol><li></li><li>a</li></ol>' : '<ol><li><br></li><li>a</li></ol>';258 editor.getBody().innerHTML = (tinymce.isIE && tinymce.Env.ie < 11) ? '<ol><li></li><li>a</li></ol>' : '<ol><li><br></li><li>a</li></ol>'; 259 259 Utils.setSelection('li', 0); 260 260 Utils.pressEnter(); 261 equal(editor.getContent(), '<p>\u00a0</p><ol><li>a</li></ol>');261 equal(editor.getContent(), '<p>\u00a0</p><ol><li>a</li></ol>'); 262 262 equal(editor.selection.getNode().nodeName, 'P'); 263 263 }); 264 264 265 265 test('Enter inside empty li at the end of ol', function() { 266 editor.getBody().innerHTML = (tinymce.isIE && tinymce.Env.ie < 11) ? '<ol><li>a</li><li></li></ol>' : '<ol><li>a</li><li><br></li></ol>';266 editor.getBody().innerHTML = (tinymce.isIE && tinymce.Env.ie < 11) ? '<ol><li>a</li><li></li></ol>' : '<ol><li>a</li><li><br></li></ol>'; 267 267 Utils.setSelection('li:last', 0); 268 268 Utils.pressEnter(); 269 equal(editor.getContent(), '<ol><li>a</li></ol><p>\u00a0</p>');269 equal(editor.getContent(), '<ol><li>a</li></ol><p>\u00a0</p>'); 270 270 equal(editor.selection.getNode().nodeName, 'P'); 271 271 }); 272 272 273 273 test('Shift+Enter inside empty li in the middle of ol', function() { 274 editor.getBody().innerHTML = (tinymce.isIE && tinymce.Env.ie < 11) ? '<ol><li>a</li><li></li><li>b</li></ol>' :'<ol><li>a</li><li><br></li><li>b</li></ol>';274 editor.getBody().innerHTML = (tinymce.isIE && tinymce.Env.ie < 11) ? '<ol><li>a</li><li></li><li>b</li></ol>' : '<ol><li>a</li><li><br></li><li>b</li></ol>'; 275 275 Utils.setSelection('li:nth-child(2)', 0); 276 276 Utils.pressEnter({shiftKey: true}); 277 equal(editor.getContent(), '<ol><li>a</li></ol><p>\u00a0</p><ol><li>b</li></ol>');277 equal(editor.getContent(), '<ol><li>a</li></ol><p>\u00a0</p><ol><li>b</li></ol>'); 278 278 equal(editor.selection.getNode().nodeName, 'P'); 279 279 }); 280 280 281 281 test('Shift+Enter inside empty li in beginning of ol', function() { 282 editor.getBody().innerHTML = (tinymce.isIE && tinymce.Env.ie < 11) ? '<ol><li></li><li>a</li></ol>' : '<ol><li><br></li><li>a</li></ol>';282 editor.getBody().innerHTML = (tinymce.isIE && tinymce.Env.ie < 11) ? '<ol><li></li><li>a</li></ol>' : '<ol><li><br></li><li>a</li></ol>'; 283 283 Utils.setSelection('li', 0); 284 284 Utils.pressEnter({shiftKey: true}); 285 equal(editor.getContent(), '<p>\u00a0</p><ol><li>a</li></ol>');285 equal(editor.getContent(), '<p>\u00a0</p><ol><li>a</li></ol>'); 286 286 equal(editor.selection.getNode().nodeName, 'P'); 287 287 }); 288 288 289 289 test('Shift+Enter inside empty li at the end of ol', function() { 290 editor.getBody().innerHTML = (tinymce.isIE && tinymce.Env.ie < 11) ? '<ol><li>a</li><li></li></ol>' : '<ol><li>a</li><li><br></li></ol>';290 editor.getBody().innerHTML = (tinymce.isIE && tinymce.Env.ie < 11) ? '<ol><li>a</li><li></li></ol>' : '<ol><li>a</li><li><br></li></ol>'; 291 291 Utils.setSelection('li:last', 0); 292 292 Utils.pressEnter({shiftKey: true}); 293 equal(editor.getContent(), '<ol><li>a</li></ol><p>\u00a0</p>');293 equal(editor.getContent(), '<ol><li>a</li></ol><p>\u00a0</p>'); 294 294 equal(editor.selection.getNode().nodeName, 'P'); 295 295 }); … … 297 297 test('Enter inside empty li in the middle of ol with forced_root_block: false', function() { 298 298 editor.settings.forced_root_block = false; 299 editor.getBody().innerHTML = (tinymce.isIE && tinymce.Env.ie < 11) ? '<ol><li>a</li><li></li><li>b</li></ol>' :'<ol><li>a</li><li><br></li><li>b</li></ol>';299 editor.getBody().innerHTML = (tinymce.isIE && tinymce.Env.ie < 11) ? '<ol><li>a</li><li></li><li>b</li></ol>' : '<ol><li>a</li><li><br></li><li>b</li></ol>'; 300 300 Utils.setSelection('li:nth-child(2)', 0); 301 301 Utils.pressEnter(); 302 equal(editor.getContent(), '<ol><li>a</li></ol><br /><ol><li>b</li></ol>');302 equal(editor.getContent(), '<ol><li>a</li></ol><br /><ol><li>b</li></ol>'); 303 303 equal(editor.selection.getNode().nodeName, 'BODY'); 304 304 }); … … 306 306 test('Enter inside empty li in beginning of ol with forced_root_block: false', function() { 307 307 editor.settings.forced_root_block = false; 308 editor.getBody().innerHTML = (tinymce.isIE && tinymce.Env.ie < 11) ? '<ol><li></li><li>a</li></ol>' : '<ol><li><br></li><li>a</li></ol>';308 editor.getBody().innerHTML = (tinymce.isIE && tinymce.Env.ie < 11) ? '<ol><li></li><li>a</li></ol>' : '<ol><li><br></li><li>a</li></ol>'; 309 309 Utils.setSelection('li', 0); 310 310 Utils.pressEnter(); 311 equal(editor.getContent(), '<br /><ol><li>a</li></ol>');311 equal(editor.getContent(), '<br /><ol><li>a</li></ol>'); 312 312 equal(editor.selection.getNode().nodeName, 'BODY'); 313 313 }); … … 315 315 test('Enter inside empty li at the end of ol with forced_root_block: false', function() { 316 316 editor.settings.forced_root_block = false; 317 editor.getBody().innerHTML = (tinymce.isIE && tinymce.Env.ie < 11) ? '<ol><li>a</li><li></li></ol>' : '<ol><li>a</li><li><br></li></ol>';317 editor.getBody().innerHTML = (tinymce.isIE && tinymce.Env.ie < 11) ? '<ol><li>a</li><li></li></ol>' : '<ol><li>a</li><li><br></li></ol>'; 318 318 Utils.setSelection('li:last', 0); 319 319 Utils.pressEnter(); … … 323 323 324 324 test('Enter inside empty li in the middle of ol', function() { 325 editor.getBody().innerHTML = (tinymce.isIE && tinymce.Env.ie < 11) ? '<ol><li>a</li><li></li><li>b</li></ol>' :'<ol><li>a</li><li><br></li><li>b</li></ol>';325 editor.getBody().innerHTML = (tinymce.isIE && tinymce.Env.ie < 11) ? '<ol><li>a</li><li></li><li>b</li></ol>' : '<ol><li>a</li><li><br></li><li>b</li></ol>'; 326 326 Utils.setSelection('li:nth-child(2)', 0); 327 327 Utils.pressEnter(); 328 equal(editor.getContent(), '<ol><li>a</li></ol><p>\u00a0</p><ol><li>b</li></ol>');328 equal(editor.getContent(), '<ol><li>a</li></ol><p>\u00a0</p><ol><li>b</li></ol>'); 329 329 equal(editor.selection.getNode().nodeName, 'P'); 330 330 }); … … 558 558 Utils.setSelection('dt', 0); 559 559 Utils.pressEnter(); 560 equal(editor.getContent(), '<dl><dt>\u00a0</dt><dt>a</dt></dl>');560 equal(editor.getContent(), '<dl><dt>\u00a0</dt><dt>a</dt></dl>'); 561 561 equal(editor.selection.getNode().nodeName, 'DT'); 562 562 }); … … 566 566 Utils.setSelection('dd', 0); 567 567 Utils.pressEnter(); 568 equal(editor.getContent(), '<dl><dd>\u00a0</dd><dd>a</dd></dl>');568 equal(editor.getContent(), '<dl><dd>\u00a0</dd><dd>a</dd></dl>'); 569 569 equal(editor.selection.getNode().nodeName, 'DD'); 570 570 }); … … 574 574 Utils.setSelection('dt:nth-child(2)', 0); 575 575 Utils.pressEnter(); 576 equal(editor.getContent(), '<dl><dt>a</dt><dt>\u00a0</dt><dt>b</dt><dt>c</dt></dl>');576 equal(editor.getContent(), '<dl><dt>a</dt><dt>\u00a0</dt><dt>b</dt><dt>c</dt></dl>'); 577 577 equal(editor.selection.getNode().nodeName, 'DT'); 578 578 }); … … 582 582 Utils.setSelection('dd:nth-child(2)', 0); 583 583 Utils.pressEnter(); 584 equal(editor.getContent(), '<dl><dd>a</dd><dd>\u00a0</dd><dd>b</dd><dd>c</dd></dl>');584 equal(editor.getContent(), '<dl><dd>a</dd><dd>\u00a0</dd><dd>b</dd><dd>c</dd></dl>'); 585 585 equal(editor.selection.getNode().nodeName, 'DD'); 586 586 }); … … 590 590 Utils.setSelection('dt', 1); 591 591 Utils.pressEnter(); 592 equal(editor.getContent(), '<dl><dt>a</dt><dt>\u00a0</dt></dl>');592 equal(editor.getContent(), '<dl><dt>a</dt><dt>\u00a0</dt></dl>'); 593 593 equal(editor.selection.getNode().nodeName, 'DT'); 594 594 }); … … 598 598 Utils.setSelection('dd', 1); 599 599 Utils.pressEnter(); 600 equal(editor.getContent(), '<dl><dd>a</dd><dd>\u00a0</dd></dl>');600 equal(editor.getContent(), '<dl><dd>a</dd><dd>\u00a0</dd></dl>'); 601 601 equal(editor.selection.getNode().nodeName, 'DD'); 602 602 }); … … 606 606 Utils.setSelection('dt:nth-child(2)', 0); 607 607 Utils.pressEnter(); 608 equal(editor.getContent(), '<dl><dt>a</dt></dl><p>\u00a0</p>');608 equal(editor.getContent(), '<dl><dt>a</dt></dl><p>\u00a0</p>'); 609 609 equal(editor.selection.getNode().nodeName, 'P'); 610 610 }); … … 614 614 Utils.setSelection('dd:nth-child(2)', 0); 615 615 Utils.pressEnter(); 616 equal(editor.getContent(), '<dl><dd>a</dd></dl><p>\u00a0</p>');616 equal(editor.getContent(), '<dl><dd>a</dd></dl><p>\u00a0</p>'); 617 617 equal(editor.selection.getNode().nodeName, 'P'); 618 618 }); … … 622 622 Utils.setSelection('p', 0); 623 623 Utils.pressEnter(); 624 equal(editor.getContent(), '<ol><li></li><li><p>abcd</p></li></ol>');624 equal(editor.getContent(), '<ol><li></li><li><p>abcd</p></li></ol>'); 625 625 equal(editor.selection.getNode().nodeName, 'P'); 626 626 }); … … 630 630 Utils.setSelection('p', 2); 631 631 Utils.pressEnter(); 632 equal(editor.getContent(), '<ol><li><p>ab</p></li><li><p>cd</p></li></ol>');632 equal(editor.getContent(), '<ol><li><p>ab</p></li><li><p>cd</p></li></ol>'); 633 633 634 634 // Ignore on IE 7, 8 this is a known bug not worth fixing … … 642 642 Utils.setSelection('p', 4); 643 643 Utils.pressEnter(); 644 equal(editor.getContent(), '<ol><li><p>abcd</p></li><li></li></ol>');644 equal(editor.getContent(), '<ol><li><p>abcd</p></li><li></li></ol>'); 645 645 equal(editor.selection.getNode().nodeName, 'LI'); 646 646 }); … … 651 651 Utils.setSelection('p', 0); 652 652 Utils.pressEnter({shiftKey: true}); 653 equal(editor.getContent(), '<ol><li><p><br />abcd</p></li></ol>');653 equal(editor.getContent(), '<ol><li><p><br />abcd</p></li></ol>'); 654 654 equal(editor.selection.getNode().nodeName, 'P'); 655 655 }); … … 659 659 Utils.setSelection('p', 2); 660 660 Utils.pressEnter({shiftKey: true}); 661 equal(editor.getContent(), '<ol><li><p>ab<br />cd</p></li></ol>');661 equal(editor.getContent(), '<ol><li><p>ab<br />cd</p></li></ol>'); 662 662 equal(editor.selection.getNode().nodeName, 'P'); 663 663 }); … … 667 667 Utils.setSelection('p', 4); 668 668 Utils.pressEnter({shiftKey: true}); 669 equal(editor.getContent(), (tinymce.isIE && tinymce.Env.ie < 11) ? '<ol><li><p>abcd</p></li></ol>': '<ol><li><p>abcd<br /><br /></p></li></ol>');669 equal(editor.getContent(), (tinymce.isIE && tinymce.Env.ie < 11) ? '<ol><li><p>abcd</p></li></ol>' : '<ol><li><p>abcd<br /><br /></p></li></ol>'); 670 670 equal(editor.selection.getNode().nodeName, 'P'); 671 671 }); … … 676 676 Utils.setSelection('p', 0); 677 677 Utils.pressEnter({ctrlKey: true}); 678 equal(editor.getContent(), '<ol><li><p>\u00a0</p><p>abcd</p></li></ol>');678 equal(editor.getContent(), '<ol><li><p>\u00a0</p><p>abcd</p></li></ol>'); 679 679 equal(editor.selection.getNode().nodeName, 'P'); 680 680 }); … … 684 684 Utils.setSelection('p', 2); 685 685 Utils.pressEnter({ctrlKey: true}); 686 equal(editor.getContent(), '<ol><li><p>ab</p><p>cd</p></li></ol>');686 equal(editor.getContent(), '<ol><li><p>ab</p><p>cd</p></li></ol>'); 687 687 equal(editor.selection.getNode().nodeName, 'P'); 688 688 }); … … 692 692 Utils.setSelection('p', 4); 693 693 Utils.pressEnter({ctrlKey: true}); 694 equal(editor.getContent(), '<ol><li><p>abcd</p><p>\u00a0</p></li></ol>');694 equal(editor.getContent(), '<ol><li><p>abcd</p><p>\u00a0</p></li></ol>'); 695 695 equal(editor.selection.getNode().nodeName, 'P'); 696 696 }); … … 702 702 Utils.setSelection('p', 2); 703 703 Utils.pressEnter(); 704 equal(editor.getContent(), '<p>ab<br />c</p>');704 equal(editor.getContent(), '<p>ab<br />c</p>'); 705 705 }); 706 706 … … 710 710 Utils.setSelection('p', 3); 711 711 Utils.pressEnter(); 712 equal(Utils.cleanHtml(editor.getBody().innerHTML), (tinymce.isIE && tinymce.Env.ie < 11) ? '<p>abc<br></p>' : '<p>abc<br><br></p>');712 equal(Utils.cleanHtml(editor.getBody().innerHTML), (tinymce.isIE && tinymce.Env.ie < 11) ? '<p>abc<br></p>' : '<p>abc<br><br></p>'); 713 713 }); 714 714 … … 737 737 editor.focus(); 738 738 Utils.pressEnter(); 739 equal(Utils.cleanHtml(editor.getBody().innerHTML), (tinymce.isIE && tinymce.Env.ie < 11) ? 'abcd<br>' : 'abcd<br><br>');739 equal(Utils.cleanHtml(editor.getBody().innerHTML), (tinymce.isIE && tinymce.Env.ie < 11) ? 'abcd<br>' : 'abcd<br><br>'); 740 740 }); 741 741 742 742 test('Enter in empty P at the end of a blockquote and end_container_on_empty_block: true', function() { 743 743 editor.settings.end_container_on_empty_block = true; 744 editor.getBody().innerHTML = (tinymce.isIE && tinymce.Env.ie < 11) ? '<blockquote><p>abc</p><p></p></blockquote>' : '<blockquote><p>abc</p><p><br></p></blockquote>';744 editor.getBody().innerHTML = (tinymce.isIE && tinymce.Env.ie < 11) ? '<blockquote><p>abc</p><p></p></blockquote>' : '<blockquote><p>abc</p><p><br></p></blockquote>'; 745 745 Utils.setSelection('p:last', 0); 746 746 Utils.pressEnter(); 747 equal(editor.getContent(), '<blockquote><p>abc</p></blockquote><p>\u00a0</p>');747 equal(editor.getContent(), '<blockquote><p>abc</p></blockquote><p>\u00a0</p>'); 748 748 }); 749 749 750 750 test('Enter in empty P at the beginning of a blockquote and end_container_on_empty_block: true', function() { 751 751 editor.settings.end_container_on_empty_block = true; 752 editor.getBody().innerHTML = (tinymce.isIE && tinymce.Env.ie < 11) ? '<blockquote><p></p><p>abc</p></blockquote>' : '<blockquote><p><br></p><p>abc</p></blockquote>';752 editor.getBody().innerHTML = (tinymce.isIE && tinymce.Env.ie < 11) ? '<blockquote><p></p><p>abc</p></blockquote>' : '<blockquote><p><br></p><p>abc</p></blockquote>'; 753 753 Utils.setSelection('p', 0); 754 754 Utils.pressEnter(); 755 equal(editor.getContent(), '<p>\u00a0</p><blockquote><p>abc</p></blockquote>');755 equal(editor.getContent(), '<p>\u00a0</p><blockquote><p>abc</p></blockquote>'); 756 756 }); 757 757 758 758 test('Enter in empty P at in the middle of a blockquote and end_container_on_empty_block: true', function() { 759 759 editor.settings.end_container_on_empty_block = true; 760 editor.getBody().innerHTML = (tinymce.isIE && tinymce.Env.ie < 11) ? '<blockquote><p>abc</p><p></p><p>123</p></blockquote>' : '<blockquote><p>abc</p><p><br></p><p>123</p></blockquote>';760 editor.getBody().innerHTML = (tinymce.isIE && tinymce.Env.ie < 11) ? '<blockquote><p>abc</p><p></p><p>123</p></blockquote>' : '<blockquote><p>abc</p><p><br></p><p>123</p></blockquote>'; 761 761 Utils.setSelection('p:nth-child(2)', 0); 762 762 Utils.pressEnter(); 763 equal(editor.getContent(), '<blockquote><p>abc</p></blockquote><p>\u00a0</p><blockquote><p>123</p></blockquote>');763 equal(editor.getContent(), '<blockquote><p>abc</p></blockquote><p>\u00a0</p><blockquote><p>123</p></blockquote>'); 764 764 }); 765 765 … … 769 769 Utils.setSelection('p', 0); 770 770 Utils.pressEnter(); 771 equal(editor.getContent(), '<p>\u00a0</p><p>\u00a0</p><p>\u00a0</p><p>X</p>');771 equal(editor.getContent(), '<p>\u00a0</p><p>\u00a0</p><p>\u00a0</p><p>X</p>'); 772 772 }); 773 773 … … 777 777 Utils.setSelection('h1', 1); 778 778 Utils.pressEnter(); 779 equal(editor.getContent(), '<h1>a</h1><p class="class1">\u00a0</p>');779 equal(editor.getContent(), '<h1>a</h1><p class="class1">\u00a0</p>'); 780 780 }); 781 781 … … 784 784 Utils.setSelection('p', 0); 785 785 Utils.pressEnter({shiftKey: true}); 786 equal(editor.getContent(), '<p><br />abc</p>');786 equal(editor.getContent(), '<p><br />abc</p>'); 787 787 }); 788 788 … … 791 791 Utils.setSelection('p', 2); 792 792 Utils.pressEnter({shiftKey: true}); 793 equal(editor.getContent(), '<p>ab<br />cd</p>');793 equal(editor.getContent(), '<p>ab<br />cd</p>'); 794 794 }); 795 795 … … 798 798 Utils.setSelection('p', 4); 799 799 Utils.pressEnter({shiftKey: true}); 800 equal(editor.getContent(), (tinymce.isIE && tinymce.Env.ie < 11) ? '<p>abcd</p>': '<p>abcd<br /><br /></p>');800 equal(editor.getContent(), (tinymce.isIE && tinymce.Env.ie < 11) ? '<p>abcd</p>' : '<p>abcd<br /><br /></p>'); 801 801 }); 802 802 … … 805 805 Utils.setSelection('b', 2); 806 806 Utils.pressEnter({shiftKey: true}); 807 equal(editor.getContent(), '<p><b>ab<br />cd</b></p>');807 equal(editor.getContent(), '<p><b>ab<br />cd</b></p>'); 808 808 }); 809 809 … … 812 812 Utils.setSelection('b', 4); 813 813 Utils.pressEnter({shiftKey: true}); 814 equal(editor.getContent(), '<p><b>abcd<br /></b></p>');814 equal(editor.getContent(), '<p><b>abcd<br /></b></p>'); 815 815 }); 816 816 … … 819 819 Utils.setSelection('pre', 0); 820 820 Utils.pressEnter(); 821 equal(editor.getContent(), '<pre><br />abc</pre>');821 equal(editor.getContent(), '<pre><br />abc</pre>'); 822 822 }); 823 823 … … 826 826 Utils.setSelection('pre', 2); 827 827 Utils.pressEnter(); 828 equal(editor.getContent(), '<pre>ab<br />cd</pre>');828 equal(editor.getContent(), '<pre>ab<br />cd</pre>'); 829 829 }); 830 830 … … 833 833 Utils.setSelection('pre', 4); 834 834 Utils.pressEnter(); 835 equal(editor.getContent(), (tinymce.isIE && tinymce.Env.ie < 11) ? '<pre>abcd</pre>': '<pre>abcd<br /><br /></pre>');835 equal(editor.getContent(), (tinymce.isIE && tinymce.Env.ie < 11) ? '<pre>abcd</pre>' : '<pre>abcd<br /><br /></pre>'); 836 836 }); 837 837 … … 841 841 Utils.setSelection('pre', 0); 842 842 Utils.pressEnter(); 843 equal(editor.getContent(), '<pre>\u00a0</pre><pre>abc</pre>');843 equal(editor.getContent(), '<pre>\u00a0</pre><pre>abc</pre>'); 844 844 }); 845 845 … … 849 849 Utils.setSelection('pre', 2); 850 850 Utils.pressEnter(); 851 equal(editor.getContent(), '<pre>ab</pre><pre>cd</pre>');851 equal(editor.getContent(), '<pre>ab</pre><pre>cd</pre>'); 852 852 }); 853 853 … … 857 857 Utils.setSelection('pre', 4); 858 858 Utils.pressEnter(); 859 equal(editor.getContent(), '<pre>abcd</pre><p>\u00a0</p>');859 equal(editor.getContent(), '<pre>abcd</pre><p>\u00a0</p>'); 860 860 }); 861 861 … … 864 864 Utils.setSelection('pre', 0); 865 865 Utils.pressEnter({shiftKey: true}); 866 equal(editor.getContent(), '<pre>\u00a0</pre><pre>abc</pre>');866 equal(editor.getContent(), '<pre>\u00a0</pre><pre>abc</pre>'); 867 867 }); 868 868 … … 871 871 Utils.setSelection('pre', 2); 872 872 Utils.pressEnter({shiftKey: true}); 873 equal(editor.getContent(), '<pre>ab</pre><pre>cd</pre>');873 equal(editor.getContent(), '<pre>ab</pre><pre>cd</pre>'); 874 874 }); 875 875 … … 878 878 Utils.setSelection('pre', 4); 879 879 Utils.pressEnter({shiftKey: true}); 880 equal(editor.getContent(), '<pre>abcd</pre><p>\u00a0</p>');880 equal(editor.getContent(), '<pre>abcd</pre><p>\u00a0</p>'); 881 881 }); 882 882 … … 886 886 Utils.setSelection('p', 0); 887 887 Utils.pressEnter({shiftKey: true}); 888 equal(editor.getContent(), '<p>\u00a0</p><p>abc</p>');888 equal(editor.getContent(), '<p>\u00a0</p><p>abc</p>'); 889 889 }); 890 890 … … 894 894 Utils.setSelection('p', 2); 895 895 Utils.pressEnter({shiftKey: true}); 896 equal(editor.getContent(), '<p>ab</p><p>cd</p>');896 equal(editor.getContent(), '<p>ab</p><p>cd</p>'); 897 897 }); 898 898 … … 902 902 Utils.setSelection('p', 3); 903 903 Utils.pressEnter({shiftKey: true}); 904 equal(editor.getContent(), '<p>abc</p><p>\u00a0</p>');904 equal(editor.getContent(), '<p>abc</p><p>\u00a0</p>'); 905 905 }); 906 906 … … 913 913 editor.selection.setRng(rng); 914 914 Utils.pressEnter({shiftKey: true}); 915 equal(editor.getContent(), '<p>ab</p><p>cd</p>');915 equal(editor.getContent(), '<p>ab</p><p>cd</p>'); 916 916 }); 917 917 … … 921 921 Utils.setSelection('div', 4); 922 922 Utils.pressEnter(); 923 equal(editor.getContent(), '<div style="position: absolute; top: 1px; left: 2px;"><p>abcd</p><p>\u00a0</p></div>');923 equal(editor.getContent(), '<div style="position: absolute; top: 1px; left: 2px;"><p>abcd</p><p>\u00a0</p></div>'); 924 924 }); 925 925 … … 972 972 Utils.setSelection('span', 1); 973 973 Utils.pressEnter(); 974 equal(editor.getContent(), '<p><em><span style="font-size: 13px;">X</span></em></p><p>\u00a0</p>');974 equal(editor.getContent(), '<p><em><span style="font-size: 13px;">X</span></em></p><p>\u00a0</p>'); 975 975 }); 976 976 … … 980 980 Utils.setSelection('li', 2); 981 981 Utils.pressEnter({shiftKey: true}); 982 equal(editor.getContent(), '<ul><li>te<br />xt</li></ul>');982 equal(editor.getContent(), '<ul><li>te<br />xt</li></ul>'); 983 983 }); 984 984 … … 989 989 Utils.setSelection('body', 2); 990 990 Utils.pressEnter(); 991 equal(editor.getContent(), '<p>te</p><p>xt</p>');991 equal(editor.getContent(), '<p>te</p><p>xt</p>'); 992 992 }); 993 993 … … 1014 1014 editor.selection.setRng(rng); 1015 1015 Utils.pressEnter(); 1016 equal(editor.getContent(), '<div>a<span>b</span>c</div><p>\u00a0</p><p>\u00a0</p><div>d</div>');1016 equal(editor.getContent(), '<div>a<span>b</span>c</div><p>\u00a0</p><p>\u00a0</p><div>d</div>'); 1017 1017 }); 1018 1018 } … … 1029 1029 1030 1030 Utils.pressEnter(); 1031 equal(editor.getContent(), '<table><tbody><tr><td>x</td></tr></tbody></table><p>\u00a0</p>');1031 equal(editor.getContent(), '<table><tbody><tr><td>x</td></tr></tbody></table><p>\u00a0</p>'); 1032 1032 }); 1033 1033 … … 1041 1041 1042 1042 Utils.pressEnter(); 1043 equal(editor.getContent(), '<p>\u00a0</p><table><tbody><tr><td>x</td></tr></tbody></table>');1043 equal(editor.getContent(), '<p>\u00a0</p><table><tbody><tr><td>x</td></tr></tbody></table>'); 1044 1044 }); 1045 1045 … … 1053 1053 1054 1054 Utils.pressEnter(); 1055 equal(editor.getContent(), '<table><tbody><tr><td>x</td></tr></tbody></table><p>\u00a0</p><p>x</p>');1055 equal(editor.getContent(), '<table><tbody><tr><td>x</td></tr></tbody></table><p>\u00a0</p><p>x</p>'); 1056 1056 }); 1057 1057 … … 1065 1065 1066 1066 Utils.pressEnter(); 1067 equal(editor.getContent(), '<p>x</p><p>\u00a0</p><table><tbody><tr><td>x</td></tr></tbody></table>');1067 equal(editor.getContent(), '<p>x</p><p>\u00a0</p><table><tbody><tr><td>x</td></tr></tbody></table>'); 1068 1068 }); 1069 1069 … … 1078 1078 Utils.pressEnter(); 1079 1079 Utils.pressEnter(); 1080 equal(editor.getContent(),'<p>\u00a0</p><p>\u00a0</p><table><tbody><tr><td>x</td></tr></tbody></table>'); 1080 equal(editor.getContent(), '<p>\u00a0</p><p>\u00a0</p><table><tbody><tr><td>x</td></tr></tbody></table>'); 1081 }); 1082 1083 test('Enter after span with space', function() { 1084 editor.setContent('<p><b>abc </b></p>'); 1085 Utils.setSelection('b', 3); 1086 Utils.pressEnter(); 1087 equal(editor.getContent(), '<p><b>abc</b></p><p>\u00a0</p>'); 1088 1089 var rng = editor.selection.getRng(true); 1090 equal(rng.startContainer.nodeName, 'B'); 1091 notEqual(rng.startContainer.data, ' '); 1081 1092 }); 1082 1093 }
Note: See TracChangeset
for help on using the changeset viewer.