瀏覽代碼

Added a test for insertContent using the selection position.

Piotrek Koszuliński 5 年之前
父節點
當前提交
e703407a27
共有 1 個文件被更改,包括 18 次插入0 次删除
  1. 18 0
      packages/ckeditor5-engine/tests/model/utils/insertcontent.js

+ 18 - 0
packages/ckeditor5-engine/tests/model/utils/insertcontent.js

@@ -223,6 +223,24 @@ describe( 'DataController utils', () => {
 			expect( doc.getRoot().getChild( 0 ).getChild( 1 ) ).to.equal( content );
 		} );
 
+		it( 'should use the selection set by deleteContent()', () => {
+			model.on( 'deleteContent', evt => {
+				evt.stop();
+
+				model.change( writer => {
+					writer.setSelection( root.getChild( 0 ), 'end' );
+				} );
+			}, { priority: 'high' } );
+
+			model.schema.register( 'paragraph', { inheritAllFrom: '$block' } );
+
+			setData( model, '<paragraph>[fo]o</paragraph>' );
+
+			insertHelper( 'xyz' );
+
+			expect( getData( model ) ).to.equal( '<paragraph>fooxyz[]</paragraph>' );
+		} );
+
 		describe( 'in simple scenarios', () => {
 			beforeEach( () => {
 				model = new Model();