Przeglądaj źródła

Added a test for #2010.

Piotrek Koszuliński 5 lat temu
rodzic
commit
fecba6f112

+ 26 - 0
packages/ckeditor5-engine/tests/model/utils/insertcontent.js

@@ -697,6 +697,32 @@ describe( 'DataController utils', () => {
 						'<listItem>]o</listItem>'
 					);
 				} );
+
+				// See ckeditor5#2010.
+				it( 'should handle bQ+p over bQ+p insertion', () => {
+					model.schema.register( 'blockQuote', {
+						allowWhere: '$block',
+						allowContentOf: '$root'
+					} );
+
+					setData( model, '<blockQuote><paragraph>[foo</paragraph></blockQuote><paragraph>bar]</paragraph>' );
+
+					const affectedRange = insertHelper( '<blockQuote><paragraph>xxx</paragraph></blockQuote><paragraph>yyy</paragraph>' );
+
+					expect( getData( model ) ).to.equal(
+						'<blockQuote>' +
+							'<paragraph>xxx</paragraph>' +
+						'</blockQuote>' +
+						'<paragraph>yyy[]</paragraph>'
+					);
+
+					expect( stringify( root, affectedRange ) ).to.equal(
+						'[<blockQuote>' +
+							'<paragraph>xxx</paragraph>' +
+						'</blockQuote>' +
+						'<paragraph>yyy</paragraph>]'
+					);
+				} );
 			} );
 
 			describe( 'mixed content to block', () => {