Преглед изворни кода

Added tests for upcasting inline elements inside a table cell.

Kuba Niegowski пре 5 година
родитељ
комит
0f9c149eb4
1 измењених фајлова са 42 додато и 0 уклоњено
  1. 42 0
      packages/ckeditor5-table/tests/converters/upcasttable.js

+ 42 - 0
packages/ckeditor5-table/tests/converters/upcasttable.js

@@ -500,6 +500,48 @@ describe( 'upcastTable()', () => {
 		} );
 	} );
 
+	describe( 'inline contents', () => {
+		it( 'should upcast inline element inside a table cell', () => {
+			model.schema.register( 'inline', { allowWhere: '$text', isInline: true } );
+			model.schema.extend( '$text', { allowIn: 'inline' } );
+			editor.conversion.elementToElement( { model: 'inline', view: 'span' } );
+
+			editor.setData(
+				'<table>' +
+					'<tr>' +
+						'<td>' +
+							'<span>foo</span>' +
+						'</td>' +
+					'</tr>' +
+				'</table>'
+			);
+
+			expectModel( modelTable( [
+				[ '<paragraph><inline>foo</inline></paragraph>' ]
+			] ) );
+		} );
+
+		it( 'should upcast inline object inside a table cell', () => {
+			model.schema.register( 'inline', { allowWhere: '$text', isInline: true, isObject: true } );
+			model.schema.extend( '$text', { allowIn: 'inline' } );
+			editor.conversion.elementToElement( { model: 'inline', view: 'span' } );
+
+			editor.setData(
+				'<table>' +
+					'<tr>' +
+						'<td>' +
+							'<span>foo</span>' +
+						'</td>' +
+					'</tr>' +
+				'</table>'
+			);
+
+			expectModel( modelTable( [
+				[ '<paragraph><inline>foo</inline></paragraph>' ]
+			] ) );
+		} );
+	} );
+
 	describe( 'handling redundant whitespacing between table elements', () => {
 		it( 'table without thead/tbody/tfoot', () => {
 			editor.setData(