浏览代码

Add tests for border-style, border-color and border-width upcast.

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

+ 28 - 4
packages/ckeditor5-table/tests/converters/tablestyles.js

@@ -9,7 +9,7 @@ import Widget from '@ckeditor/ckeditor5-widget/src/widget';
 import TableEditing from '../../src/tableediting';
 import TableStyleEditing from '../../src/tablestyleediting';
 
-describe( 'Table styles conversion', () => {
+describe.only( 'Table styles conversion', () => {
 	let editor, model;
 
 	beforeEach( () => {
@@ -29,15 +29,39 @@ describe( 'Table styles conversion', () => {
 
 	describe( 'upcast', () => {
 		describe( 'table cell', () => {
-			it( 'should parser border shorthand', () => {
-				editor.setData( '<table><tr><td style="border:1px solid blue">foo</td></tr></table>' );
+			it( 'should upcast border shorthand', () => {
+				editor.setData( '<table><tr><td style="border:1px solid #f00">foo</td></tr></table>' );
 
 				const tableCell = model.document.getRoot().getNodeByPath( [ 0, 0, 0 ] );
 
-				assertTRBLAttribute( tableCell, 'borderColor', 'blue' );
+				assertTRBLAttribute( tableCell, 'borderColor', '#f00' );
 				assertTRBLAttribute( tableCell, 'borderStyle', 'solid' );
 				assertTRBLAttribute( tableCell, 'borderWidth', '1px' );
 			} );
+
+			it( 'should upcast border-color shorthand', () => {
+				editor.setData( '<table><tr><td style="border-color:#f00">foo</td></tr></table>' );
+
+				const tableCell = model.document.getRoot().getNodeByPath( [ 0, 0, 0 ] );
+
+				assertTRBLAttribute( tableCell, 'borderColor', '#f00' );
+			} );
+
+			it( 'should upcast border-style shorthand', () => {
+				editor.setData( '<table><tr><td style="border-style:ridge">foo</td></tr></table>' );
+
+				const tableCell = model.document.getRoot().getNodeByPath( [ 0, 0, 0 ] );
+
+				assertTRBLAttribute( tableCell, 'borderStyle', 'ridge' );
+			} );
+
+			it( 'should upcast border-width shorthand', () => {
+				editor.setData( '<table><tr><td style="border-width:1px">foo</td></tr></table>' );
+
+				const tableCell = model.document.getRoot().getNodeByPath( [ 0, 0, 0 ] );
+
+				assertTRBLAttribute( tableCell, 'borderWidth', '1px' );
+			} );
 		} );
 	} );