|
|
@@ -29,6 +29,7 @@ describe( 'Bug #59', () => {
|
|
|
|
|
|
it( 'editor does not blow up when deleting last styled character', () => {
|
|
|
editor.document.enqueueChanges( () => {
|
|
|
+ editor.editing.view.getDomRoot().focus();
|
|
|
setData( editor.document, '<paragraph><$text bold="true">foo</$text> x <$text bold="true">bar</$text>.[]</paragraph>' );
|
|
|
} );
|
|
|
|
|
|
@@ -38,4 +39,20 @@ describe( 'Bug #59', () => {
|
|
|
|
|
|
expect( editor.getData() ).to.equal( '<p> </p>' );
|
|
|
} );
|
|
|
+
|
|
|
+ // This is something that came to my mind after I worked on ckeditor/ckeditor5-engine#659.
|
|
|
+ // Toggling bold at the end creates a lot of weird cases so it's interesting to see if it works... and it didn't back then.
|
|
|
+ it( 'editor does not blow up when deleting last styled character, forcing bold switch', () => {
|
|
|
+ editor.document.enqueueChanges( () => {
|
|
|
+ editor.editing.view.getDomRoot().focus();
|
|
|
+ setData( editor.document, '<paragraph><$text bold="true">foo</$text> x <$text bold="true">bar</$text>.[]</paragraph>' );
|
|
|
+ } );
|
|
|
+
|
|
|
+ while ( editor.document.selection.anchor.offset > 0 ) {
|
|
|
+ editor.execute( 'delete' );
|
|
|
+ editor.execute( 'bold' );
|
|
|
+ }
|
|
|
+
|
|
|
+ expect( editor.getData() ).to.equal( '<p> </p>' );
|
|
|
+ } );
|
|
|
} );
|