소스 검색

Add test case for object in object case.

Maciej Gołaszewski 7 년 전
부모
커밋
41862453f5
1개의 변경된 파일20개의 추가작업 그리고 1개의 파일을 삭제
  1. 20 1
      packages/ckeditor5-engine/tests/model/utils/selection-post-fixer.js

+ 20 - 1
packages/ckeditor5-engine/tests/model/utils/selection-post-fixer.js

@@ -435,7 +435,7 @@ describe( 'Selection post-fixer', () => {
 				);
 				);
 			} );
 			} );
 
 
-			it( 'should not fix #4 - selection over blockQuote in table', () => {
+			it( 'should not fix #5 - selection over blockQuote in table', () => {
 				model.schema.register( 'blockQuote', {
 				model.schema.register( 'blockQuote', {
 					allowWhere: '$block',
 					allowWhere: '$block',
 					allowContentOf: '$root'
 					allowContentOf: '$root'
@@ -926,6 +926,25 @@ describe( 'Selection post-fixer', () => {
 					'<paragraph>fo[o<inlineWidget></inlineWidget>b]ar</paragraph>'
 					'<paragraph>fo[o<inlineWidget></inlineWidget>b]ar</paragraph>'
 				);
 				);
 			} );
 			} );
+
+			it( 'should not fix #4 - object in object', () => {
+				model.schema.register( 'div', {
+					allowWhere: '$block',
+					isObject: true
+				} );
+
+				model.schema.extend( 'div', { allowIn: 'div' } );
+
+				setModelData( model, '<div>[<div></div>]</div>' );
+
+				model.change( writer => {
+					const innerDiv = model.document.getRoot().getNodeByPath( [ 0, 0 ] );
+
+					writer.setSelection( writer.createRangeOn( innerDiv ) );
+				} );
+
+				expect( getModelData( model ) ).to.equal( '<div>[<div></div>]</div>' );
+			} );
 		} );
 		} );
 
 
 		describe( 'collapsed selection', () => {
 		describe( 'collapsed selection', () => {