Ticket #31441: 31441.18.patch
File 31441.18.patch, 2.0 KB (added by , 10 years ago) |
---|
-
src/wp-includes/js/tinymce/plugins/wptextpattern/plugin.js
87 87 } 88 88 } 89 89 90 if ( ! child.nodeValue ) { 91 child = child.nextSibling; 92 } 93 90 94 if ( child !== node ) { 91 95 return; 92 96 } … … 109 113 editor.undoManager.add(); 110 114 111 115 editor.undoManager.transact( function() { 116 var $$parent; 117 112 118 if ( replace ) { 113 119 $$( node ).replaceWith( document.createTextNode( replace ) ); 114 120 } else { 115 $$( node.parentNode ).empty().append( '<br>' ); 121 $$parent = $$( node.parentNode ); 122 123 $$( node ).remove(); 124 125 if ( ! $$parent.html() ) { 126 $$parent.append( '<br>' ); 127 } 116 128 } 117 129 118 130 editor.selection.setCursorLocation( parent ); -
tests/qunit/wp-includes/js/tinymce/plugins/wptextpattern/plugin.js
77 77 }, assert.async() ); 78 78 } ); 79 79 80 QUnit.test( 'Ordered list with content. ', function( assert ) {80 QUnit.test( 'Ordered list with content. (1)', function( assert ) { 81 81 editor.setContent( '<p><strong>test</strong></p>' ); 82 82 editor.selection.setCursorLocation(); 83 83 … … 86 86 }, assert.async() ); 87 87 } ); 88 88 89 QUnit.test( 'Ordered list with content. (2)', function( assert ) { 90 editor.setContent( '<p><strong>test</strong></p>' ); 91 editor.selection.setCursorLocation( editor.$( 'p' )[0], 0 ); 92 93 type( '* ', function() { 94 assert.equal( editor.getContent(), '<ul>\n<li><strong>test</strong></li>\n</ul>' ); 95 }, assert.async() ); 96 } ); 97 89 98 QUnit.test( 'Only transform inside a P tag.', function( assert ) { 90 99 editor.setContent( '<h1>test</h1>' ); 91 100 editor.selection.setCursorLocation();