8
0
Piotrek Koszuliński 8 жил өмнө
parent
commit
ce3a2278e0

+ 13 - 1
packages/ckeditor5-basic-styles/tests/boldengine.js

@@ -31,7 +31,8 @@ describe( 'BoldEngine', () => {
 	} );
 
 	it( 'should set proper schema rules', () => {
-		expect( doc.schema.check( { name: '$inline', attributes: [ 'bold' ] } ) ).to.be.true;
+		expect( doc.schema.check( { name: '$inline', attributes: [ 'bold' ], inside: '$root' } ) ).to.be.false;
+		expect( doc.schema.check( { name: '$inline', attributes: [ 'bold' ], inside: '$block' } ) ).to.be.true;
 	} );
 
 	describe( 'command', () => {
@@ -72,6 +73,17 @@ describe( 'BoldEngine', () => {
 
 			expect( editor.getData() ).to.equal( '<p><strong>foo</strong>bar</p>' );
 		} );
+
+		it( 'should be integrated with autoparagraphing', () => {
+			// Incorrect results because autoparagraphing works incorrectly (issue in paragraph).
+			// https://github.com/ckeditor/ckeditor5-paragraph/issues/10
+
+			editor.setData( '<strong>foo</strong>bar' );
+
+			expect( getModelData( doc, { withoutSelection: true } ) ).to.equal( '<paragraph>foobar</paragraph>' );
+
+			expect( editor.getData() ).to.equal( '<p>foobar</p>' );
+		} );
 	} );
 
 	describe( 'editing pipeline conversion', () => {

+ 12 - 0
packages/ckeditor5-basic-styles/tests/italicengine.js

@@ -31,6 +31,7 @@ describe( 'ItalicEngine', () => {
 	} );
 
 	it( 'should set proper schema rules', () => {
+		expect( doc.schema.check( { name: '$inline', attributes: [ 'italic' ], inside: '$root' } ) ).to.be.false;
 		expect( doc.schema.check( { name: '$inline', attributes: [ 'italic' ], inside: '$block' } ) ).to.be.true;
 	} );
 
@@ -72,6 +73,17 @@ describe( 'ItalicEngine', () => {
 
 			expect( editor.getData() ).to.equal( '<p><em>foo</em>bar</p>' );
 		} );
+
+		it( 'should be integrated with autoparagraphing', () => {
+			// Incorrect results because autoparagraphing works incorrectly (issue in paragraph).
+			// https://github.com/ckeditor/ckeditor5-paragraph/issues/10
+
+			editor.setData( '<em>foo</em>bar' );
+
+			expect( getModelData( doc, { withoutSelection: true } ) ).to.equal( '<paragraph>foobar</paragraph>' );
+
+			expect( editor.getData() ).to.equal( '<p>foobar</p>' );
+		} );
 	} );
 
 	describe( 'editing pipeline conversion', () => {