浏览代码

Add border longhand styles to tests.

Maciej Gołaszewski 6 年之前
父节点
当前提交
19a2ed81b1
共有 1 个文件被更改,包括 50 次插入0 次删除
  1. 50 0
      packages/ckeditor5-table/tests/converters/tablestyles.js

+ 50 - 0
packages/ckeditor5-table/tests/converters/tablestyles.js

@@ -102,6 +102,56 @@ describe.only( 'Table styles conversion', () => {
 				assertTRBLAttribute( tableCell, 'borderStyle', null, null, null, 'solid' );
 				assertTRBLAttribute( tableCell, 'borderWidth', null, null, null, '1px' );
 			} );
+
+			it( 'should upcast border-top-* styles', () => {
+				editor.setData(
+					'<table><tr><td style="border-top-width:1px;border-top-style:solid;border-top-color:#f00">foo</td></tr></table>'
+				);
+
+				const tableCell = model.document.getRoot().getNodeByPath( [ 0, 0, 0 ] );
+
+				assertTRBLAttribute( tableCell, 'borderColor', '#f00', null, null, null );
+				assertTRBLAttribute( tableCell, 'borderStyle', 'solid', null, null, null );
+				assertTRBLAttribute( tableCell, 'borderWidth', '1px', null, null, null );
+			} );
+
+			it( 'should upcast border-right-* styles', () => {
+				editor.setData(
+					'<table><tr><td style="border-right-width:1px;border-right-style:solid;border-right-color:#f00">foo</td></tr></table>'
+				);
+
+				const tableCell = model.document.getRoot().getNodeByPath( [ 0, 0, 0 ] );
+
+				assertTRBLAttribute( tableCell, 'borderColor', null, '#f00', null, null );
+				assertTRBLAttribute( tableCell, 'borderStyle', null, 'solid', null, null );
+				assertTRBLAttribute( tableCell, 'borderWidth', null, '1px', null, null );
+			} );
+
+			it( 'should upcast border-bottom-* styles', () => {
+				editor.setData(
+					'<table><tr>' +
+					'<td style="border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:#f00">foo</td>' +
+					'</tr></table>'
+				);
+
+				const tableCell = model.document.getRoot().getNodeByPath( [ 0, 0, 0 ] );
+
+				assertTRBLAttribute( tableCell, 'borderColor', null, null, '#f00', null );
+				assertTRBLAttribute( tableCell, 'borderStyle', null, null, 'solid', null );
+				assertTRBLAttribute( tableCell, 'borderWidth', null, null, '1px', null );
+			} );
+
+			it( 'should upcast border-left-* styles', () => {
+				editor.setData(
+					'<table><tr><td style="border-left-width:1px;border-left-style:solid;border-left-color:#f00">foo</td></tr></table>'
+				);
+
+				const tableCell = model.document.getRoot().getNodeByPath( [ 0, 0, 0 ] );
+
+				assertTRBLAttribute( tableCell, 'borderColor', null, null, null, '#f00' );
+				assertTRBLAttribute( tableCell, 'borderStyle', null, null, null, 'solid' );
+				assertTRBLAttribute( tableCell, 'borderWidth', null, null, null, '1px' );
+			} );
 		} );
 	} );