8
0
Просмотр исходного кода

Add table styles downcast tests stub.

Maciej Gołaszewski 6 лет назад
Родитель
Сommit
02609c15b6
1 измененных файлов с 43 добавлено и 0 удалено
  1. 43 0
      packages/ckeditor5-table/tests/converters/tablestyles.js

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

@@ -8,6 +8,8 @@ import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
 import Widget from '@ckeditor/ckeditor5-widget/src/widget';
 import TableEditing from '../../src/tableediting';
 import TableStyleEditing from '../../src/tablestyleediting';
+import { setData as setModelData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model';
+import { assertEqualMarkup } from '@ckeditor/ckeditor5-utils/tests/_utils/utils';
 
 describe( 'Table styles conversion', () => {
 	let editor, model;
@@ -155,6 +157,47 @@ describe( 'Table styles conversion', () => {
 		} );
 	} );
 
+	describe( 'downcast', () => {
+		describe( 'table cell', () => {
+			let tableCell;
+
+			beforeEach( () => {
+				setModelData(
+					model,
+					'<table headingRows="0" headingColumns="0">' +
+						'<tableRow>' +
+							'<tableCell>' +
+								'<paragraph>foo</paragraph>' +
+							'</tableCell>' +
+						'</tableRow>' +
+					'</table>'
+				);
+				tableCell = model.document.getRoot().getNodeByPath( [ 0, 0, 0 ] );
+			} );
+
+			it( 'should downcast borderStyle attribute', () => {
+				model.change( writer => writer.setAttribute( 'borderStyle', {
+					top: 'solid',
+					right: 'solid',
+					bottom: 'solid',
+					left: 'solid'
+				}, tableCell ) );
+
+				assertEqualMarkup( editor.getData(),
+					'<figure class="table">' +
+						'<table>' +
+							'<tbody>' +
+								'<tr>' +
+									'<td style="border-top:solid;border-right:solid;border-bottom:solid;border-left:solid;">foo</td>' +
+								'</tr>' +
+							'</tbody>' +
+						'</table>' +
+					'</figure>'
+				);
+			} );
+		} );
+	} );
+
 	/**
 	 * Assertion helper for top-right-bottom-left attribute object.
 	 *