浏览代码

Tests: Added a test for multiple text children insertion.

Szymon Cofalik 8 年之前
父节点
当前提交
9f6ac516b1
共有 1 个文件被更改,包括 22 次插入0 次删除
  1. 22 0
      packages/ckeditor5-typing/tests/input.js

+ 22 - 0
packages/ckeditor5-typing/tests/input.js

@@ -148,6 +148,28 @@ describe( 'Input feature', () => {
 			expect( getViewData( view ) ).to.equal( '<p>foob{}<strong>ar</strong></p>' );
 		} );
 
+		it( 'should handle multiple text node insertion', () => {
+			editor.setData( '<p></p><p></p>' );
+
+			view.fire( 'mutations', [
+				{
+					type: 'children',
+					oldChildren: [],
+					newChildren: [ new ViewText( 'x' ) ],
+					node: viewRoot.getChild( 0 )
+				},
+				{
+					type: 'children',
+					oldChildren: [],
+					newChildren: [ new ViewText( 'y' ) ],
+					node: viewRoot.getChild( 1 )
+				}
+			] );
+
+			expect( getModelData( model ) ).to.equal( '<paragraph>x</paragraph><paragraph>y[]</paragraph>' );
+			expect( getViewData( view ) ).to.equal( '<p>x</p><p>y{}</p>' );
+		} );
+
 		it( 'should do nothing when two nodes were inserted', () => {
 			editor.setData( '<p></p>' );