浏览代码

Internal: Prevent selection from ending up in an empty root.

Oskar Wróbel 8 年之前
父节点
当前提交
8906c0c827
共有 1 个文件被更改,包括 7 次插入5 次删除
  1. 7 5
      packages/ckeditor5-engine/tests/controller/insertcontent.js

+ 7 - 5
packages/ckeditor5-engine/tests/controller/insertcontent.js

@@ -281,15 +281,17 @@ describe( 'DataController', () => {
 				expect( getData( doc ) ).to.equal( '<heading1>foxyz[]ar</heading1>' );
 			} );
 
-			it( 'not inserts autoparagraph when paragraph is disallowed at the current position', () => {
+			it( 'not insert autoparagraph when paragraph is disallowed at the current position', () => {
 				doc.schema.disallow( { name: 'paragraph', inside: '$root' } );
-				doc.schema.disallow( { name: 'heading2', inside: '$root' } );
 
-				const content = new Element( 'heading2', [], [ new Text( 'bar' ) ] );
+				const content = new DocumentFragment( [
+					new Element( 'heading1', [], [ new Text( 'bar' ) ] ),
+					new Text( 'biz' )
+				] );
 
-				setData( doc, '[<heading1>foo</heading1>]' );
+				setData( doc, '[<heading2>foo</heading2>]' );
 				insertContent( dataController, content, doc.selection );
-				expect( getData( doc ) ).to.equal( '[]' );
+				expect( getData( doc ) ).to.equal( '<heading1>bar[]</heading1>' );
 			} );
 
 			describe( 'block to block handling', () => {