8
0
فهرست منبع

Add table row styles conversion tests.

Maciej Gołaszewski 6 سال پیش
والد
کامیت
58bc9718d3
1فایلهای تغییر یافته به همراه38 افزوده شده و 1 حذف شده
  1. 38 1
      packages/ckeditor5-table/tests/converters/tablestyles.js

+ 38 - 1
packages/ckeditor5-table/tests/converters/tablestyles.js

@@ -158,7 +158,16 @@ describe( 'Table styles conversion', () => {
 				editor.setData( '<table><tr><td style="background-color:#f00">foo</td></tr></table>' );
 				const tableCell = model.document.getRoot().getNodeByPath( [ 0, 0, 0 ] );
 
-				expect( tableCell.getAttribute( 'backgroundColor' ) ).to.deep.equal( '#f00' );
+				expect( tableCell.getAttribute( 'backgroundColor' ) ).to.equal( '#f00' );
+			} );
+		} );
+
+		describe( 'table row', () => {
+			it( 'should upcast height attribute', () => {
+				editor.setData( '<table><tr style="height:20px"><td>foo</td></tr></table>' );
+				const tableRow = model.document.getRoot().getNodeByPath( [ 0, 0 ] );
+
+				expect( tableRow.getAttribute( 'height' ) ).to.equal( '20px' );
 			} );
 		} );
 	} );
@@ -443,6 +452,34 @@ describe( 'Table styles conversion', () => {
 				} );
 			} );
 		} );
+
+		describe( 'table row', () => {
+			let tableRow;
+
+			beforeEach( () => {
+				setModelData(
+					model,
+					'<table headingRows="0" headingColumns="0">' +
+						'<tableRow>' +
+							'<tableCell>' +
+								'<paragraph>foo</paragraph>' +
+							'</tableCell>' +
+						'</tableRow>' +
+					'</table>'
+				);
+
+				tableRow = model.document.getRoot().getNodeByPath( [ 0, 0 ] );
+			} );
+
+			it( 'should downcast height attribute', () => {
+				model.change( writer => writer.setAttribute( 'height', '20px', tableRow ) );
+
+				assertEqualMarkup(
+					editor.getData(),
+					'<figure class="table"><table><tbody><tr style="height:20px;"><td>foo</td></tr></tbody></table></figure>'
+				);
+			} );
+		} );
 	} );
 
 	/**