Przeglądaj źródła

Updated test for model.deleteContent to make sure that doNotAutoparagraph option worked properly for empty root.

Kuba Niegowski 5 lat temu
rodzic
commit
55521d8498

+ 6 - 1
packages/ckeditor5-engine/tests/model/utils/deletecontent.js

@@ -941,7 +941,12 @@ describe( 'DataController utils', () => {
 					{ rootName: 'bodyRoot' }
 				);
 
-				deleteContent( model, doc.selection, { doNotAutoparagraph: true } );
+				// This must be tested inside a change block to check results before the post-fixers get triggered.
+				model.change( () => {
+					deleteContent( model, doc.selection, { doNotAutoparagraph: true } );
+
+					expect( getData( model, { rootName: 'bodyRoot' } ) ).to.equal( '[]' );
+				} );
 
 				// Note that auto-paragraphing post-fixer injected a paragraph into the empty root.
 				expect( getData( model, { rootName: 'bodyRoot' } ) ).to.equal( '<paragraph>[]</paragraph>' );