浏览代码

Updated tests names.

Kuba Niegowski 5 年之前
父节点
当前提交
3281216ebd

+ 29 - 25
packages/ckeditor5-engine/tests/conversion/upcastdispatcher.js

@@ -605,38 +605,42 @@ describe( 'UpcastDispatcher', () => {
 				sinon.assert.calledOnce( spy );
 			} );
 
-			it( 'should insert paragraph if it\'s allowed and if it would allow conversion', () => {
-				const spy = sinon.spy();
+			it(
+				'should auto-paragraph an element if it is not allowed at the insertion position' +
+				'but would be inserted if auto-paragraphed',
+				() => {
+					const spy = sinon.spy();
+
+					model.schema.register( 'section', {
+						allowIn: '$root'
+					} );
+					model.schema.register( 'span', {
+						allowIn: 'paragraph'
+					} );
+					model.schema.extend( 'paragraph', {
+						allowIn: 'section'
+					} );
 
-				model.schema.register( 'section', {
-					allowIn: '$root'
-				} );
-				model.schema.register( 'span', {
-					allowIn: 'paragraph'
-				} );
-				model.schema.extend( 'paragraph', {
-					allowIn: 'section'
-				} );
+					dispatcher.on( 'documentFragment', ( evt, data, conversionApi ) => {
+						const section = conversionApi.writer.createElement( 'section' );
+						const position = ModelPosition._createAt( section, 0 );
 
-				dispatcher.on( 'documentFragment', ( evt, data, conversionApi ) => {
-					const section = conversionApi.writer.createElement( 'section' );
-					const position = ModelPosition._createAt( section, 0 );
+						const span = conversionApi.writer.createElement( 'span' );
 
-					const span = conversionApi.writer.createElement( 'span' );
+						const result = conversionApi.splitToAllowedParent( span, position );
 
-					const result = conversionApi.splitToAllowedParent( span, position );
+						expect( section.getChild( 0 ).name ).to.equal( 'paragraph' );
+						expect( result ).to.deep.equal( {
+							position: ModelPosition._createAt( section.getChild( 0 ), 0 )
+						} );
 
-					expect( section.getChild( 0 ).name ).to.equal( 'paragraph' );
-					expect( result ).to.deep.equal( {
-						position: ModelPosition._createAt( section.getChild( 0 ), 0 )
+						spy();
 					} );
 
-					spy();
-				} );
-
-				model.change( writer => dispatcher.convert( new ViewDocumentFragment( viewDocument ), writer ) );
-				sinon.assert.calledOnce( spy );
-			} );
+					model.change( writer => dispatcher.convert( new ViewDocumentFragment( viewDocument ), writer ) );
+					sinon.assert.calledOnce( spy );
+				}
+			);
 
 			it( 'should return null if element is not allowed in position and any of ancestors', () => {
 				const spy = sinon.spy();

+ 1 - 1
packages/ckeditor5-engine/tests/conversion/upcasthelpers.js

@@ -969,7 +969,7 @@ describe( 'upcast-converters', () => {
 			expect( conversionResult.getChild( 0 ).data ).to.equal( 'foobar' );
 		} );
 
-		it( 'should wrap text with paragraph if it would allow conversion', () => {
+		it( 'should auto-paragraph a text if it is not allowed at the insertion position but would be inserted if auto-paragraphed', () => {
 			schema.addChildCheck( ( ctx, childDef ) => {
 				if ( childDef.name == '$text' && ctx.endsWith( '$root' ) ) {
 					return false;