瀏覽代碼

Fixed invalid test.

Kamil Piechaczek 7 年之前
父節點
當前提交
6d0e88b5c5
共有 1 個文件被更改,包括 10 次插入9 次删除
  1. 10 9
      packages/ckeditor5-engine/tests/model/schema.js

+ 10 - 9
packages/ckeditor5-engine/tests/model/schema.js

@@ -645,14 +645,15 @@ describe( 'Schema', () => {
 		beforeEach( () => {
 			schema.register( '$root' );
 			schema.register( '$block', {
-				allowIn: '$root'
+				allowIn: '$root',
+				isBlock: true
+			} );
+			schema.register( '$text', {
+				allowIn: '$block'
 			} );
 			schema.register( 'paragraph', {
 				allowWhere: '$block'
 			} );
-			schema.register( '$text', {
-				allowIn: 'paragraph'
-			} );
 			schema.register( 'blockQuote', {
 				allowWhere: '$block',
 				allowContentOf: '$root'
@@ -662,7 +663,7 @@ describe( 'Schema', () => {
 			} );
 		} );
 
-		it( 'returns false if a block is not allowed in other block', () => {
+		it( 'returns false if a block cannot be merged with other block', () => {
 			const paragraph = new Element( 'paragraph', null, [
 				new Text( 'xyz' )
 			] );
@@ -672,13 +673,13 @@ describe( 'Schema', () => {
 			expect( schema.checkMerge( listItem, blockQuote ) ).to.equal( false );
 		} );
 
-		it( 'returns true if a block is allowed in other block', () => {
-			const paragraph = new Element( 'paragraph', null, [
+		it( 'returns true if a block can be merged with other block', () => {
+			const listItem = new Element( 'listItem' );
+			const listItemToMerge = new Element( 'listItem', null, [
 				new Text( 'xyz' )
 			] );
-			const listItem = new Element( 'listItem' );
 
-			expect( schema.checkMerge( listItem, paragraph ) ).to.equal( false );
+			expect( schema.checkMerge( listItem, listItemToMerge ) ).to.equal( true );
 		} );
 	} );