8
0
فهرست منبع

Add tests for other tableCell border attributes.

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

+ 59 - 5
packages/ckeditor5-table/tests/converters/tablestyles.js

@@ -165,16 +165,27 @@ describe.only( 'Table styles conversion', () => {
 				setModelData(
 				setModelData(
 					model,
 					model,
 					'<table headingRows="0" headingColumns="0">' +
 					'<table headingRows="0" headingColumns="0">' +
-						'<tableRow>' +
-							'<tableCell>' +
-								'<paragraph>foo</paragraph>' +
-							'</tableCell>' +
-						'</tableRow>' +
+					'<tableRow>' +
+					'<tableCell>' +
+					'<paragraph>foo</paragraph>' +
+					'</tableCell>' +
+					'</tableRow>' +
 					'</table>'
 					'</table>'
 				);
 				);
 				tableCell = model.document.getRoot().getNodeByPath( [ 0, 0, 0 ] );
 				tableCell = model.document.getRoot().getNodeByPath( [ 0, 0, 0 ] );
 			} );
 			} );
 
 
+			it( 'should downcast borderColor attribute', () => {
+				model.change( writer => writer.setAttribute( 'borderColor', {
+					top: '#f00',
+					right: '#f00',
+					bottom: '#f00',
+					left: '#f00'
+				}, tableCell ) );
+
+				assertTableCellStyle( 'border-top:#f00;border-right:#f00;border-bottom:#f00;border-left:#f00;' );
+			} );
+
 			it( 'should downcast borderStyle attribute', () => {
 			it( 'should downcast borderStyle attribute', () => {
 				model.change( writer => writer.setAttribute( 'borderStyle', {
 				model.change( writer => writer.setAttribute( 'borderStyle', {
 					top: 'solid',
 					top: 'solid',
@@ -185,6 +196,49 @@ describe.only( 'Table styles conversion', () => {
 
 
 				assertTableCellStyle( 'border-top:solid;border-right:solid;border-bottom:solid;border-left:solid;' );
 				assertTableCellStyle( 'border-top:solid;border-right:solid;border-bottom:solid;border-left:solid;' );
 			} );
 			} );
+
+			it( 'should downcast borderWidth attribute', () => {
+				model.change( writer => writer.setAttribute( 'borderWidth', {
+					top: '42px',
+					right: '42px',
+					bottom: '42px',
+					left: '42px'
+				}, tableCell ) );
+
+				assertTableCellStyle( 'border-top:42px;border-right:42px;border-bottom:42px;border-left:42px;' );
+			} );
+
+			it( 'should downcast borderColor, borderStyle and borderWidth attributes together (same top, right, bottom, left)', () => {
+				model.change( writer => {
+					writer.setAttribute( 'borderColor', {
+						top: '#f00',
+						right: '#f00',
+						bottom: '#f00',
+						left: '#f00'
+					}, tableCell );
+
+					writer.setAttribute( 'borderStyle', {
+						top: 'solid',
+						right: 'solid',
+						bottom: 'solid',
+						left: 'solid'
+					}, tableCell );
+
+					writer.setAttribute( 'borderWidth', {
+						top: '42px',
+						right: '42px',
+						bottom: '42px',
+						left: '42px'
+					}, tableCell );
+				} );
+
+				assertTableCellStyle(
+					'border-top:42px solid #f00;' +
+					'border-right:42px solid #f00;' +
+					'border-bottom:42px solid #f00;' +
+					'border-left:42px solid #f00;'
+				);
+			} );
 		} );
 		} );
 	} );
 	} );