瀏覽代碼

Use TableEditing in InsertColumnCommand tests.

Maciej Gołaszewski 5 年之前
父節點
當前提交
23dde88519
共有 1 個文件被更改,包括 48 次插入17 次删除
  1. 48 17
      packages/ckeditor5-table/tests/commands/insertcolumncommand.js

+ 48 - 17
packages/ckeditor5-table/tests/commands/insertcolumncommand.js

@@ -9,9 +9,11 @@ import { getData, setData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model
 
 import InsertColumnCommand from '../../src/commands/insertcolumncommand';
 import TableSelection from '../../src/tableselection';
-import { assertSelectedCells, defaultConversion, defaultSchema, modelTable } from '../_utils/utils';
+import { assertSelectedCells, modelTable } from '../_utils/utils';
 import TableUtils from '../../src/tableutils';
 import { assertEqualMarkup } from '@ckeditor/ckeditor5-utils/tests/_utils/utils';
+import TableCellPropertiesEditing from '../../src/tablecellproperties/tablecellpropertiesediting';
+import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
 
 describe( 'InsertColumnCommand', () => {
 	let editor, model, command;
@@ -19,14 +21,11 @@ describe( 'InsertColumnCommand', () => {
 	beforeEach( () => {
 		return ModelTestEditor
 			.create( {
-				plugins: [ TableUtils, TableSelection, HorizontalLineEditing ]
+				plugins: [ Paragraph, TableCellPropertiesEditing, TableUtils, TableSelection, HorizontalLineEditing ]
 			} )
 			.then( newEditor => {
 				editor = newEditor;
 				model = editor.model;
-
-				defaultSchema( model.schema );
-				defaultConversion( editor.conversion );
 			} );
 	} );
 
@@ -168,18 +167,34 @@ describe( 'InsertColumnCommand', () => {
 			} );
 
 			it( 'should skip wide spanned columns', () => {
+				// +----+----+----+----+----+----+
+				// | 00 | 01 | 02 | 03 | 04 | 05 |
+				// +----+----+----+----+----+----+
+				// | 10 | 11 | 12      | 14 | 15 |
+				// +----+----+----+----+----+----+
+				// | 20                | 24      |
+				// +----+----+----+----+----+----+
+				//                     ^-- heading columns
 				setData( model, modelTable( [
-					[ '11', '12[]', '13', '14', '15' ],
-					[ '21', '22', { colspan: 2, contents: '23' }, '25' ],
-					[ { colspan: 4, contents: '31' }, { colspan: 2, contents: '34' } ]
+					[ '00', '01[]', '02', '03', '04', '05' ],
+					[ '10', '11', { contents: '12', colspan: 2 }, '14', '15' ],
+					[ { contents: '20', colspan: 4 }, { contents: '24', colspan: 2 } ]
 				], { headingColumns: 4 } ) );
 
 				command.execute();
 
+				// +----+----+----+----+----+----+----+
+				// | 00 | 01 |    | 02 | 03 | 04 | 05 |
+				// +----+----+----+----+----+----+----+
+				// | 10 | 11 |    | 12      | 14 | 15 |
+				// +----+----+----+----+----+----+----+
+				// | 20                     | 24      |
+				// +----+----+----+----+----+----+----+
+				//                          ^-- heading columns
 				assertEqualMarkup( getData( model ), modelTable( [
-					[ '11', '12[]', '', '13', '14', '15' ],
-					[ '21', '22', '', { colspan: 2, contents: '23' }, '25' ],
-					[ { colspan: 5, contents: '31' }, { colspan: 2, contents: '34' } ]
+					[ '00', '01[]', '', '02', '03', '04', '05' ],
+					[ '10', '11', '', { contents: '12', colspan: 2 }, '14', '15' ],
+					[ { contents: '20', colspan: 5 }, { contents: '24', colspan: 2 } ]
 				], { headingColumns: 5 } ) );
 			} );
 
@@ -335,18 +350,34 @@ describe( 'InsertColumnCommand', () => {
 			} );
 
 			it( 'should skip wide spanned columns', () => {
+				// +----+----+----+----+----+----+
+				// | 00 | 01 | 02 | 03 | 04 | 05 |
+				// +----+----+----+----+----+----+
+				// | 10 | 11 | 12      | 14 | 15 |
+				// +----+----+----+----+----+----+
+				// | 20                | 24      |
+				// +----+----+----+----+----+----+
+				//                     ^-- heading columns
 				setData( model, modelTable( [
-					[ '11', '12', '13[]', '14', '15' ],
-					[ '21', '22', { colspan: 2, contents: '23' }, '25' ],
-					[ { colspan: 4, contents: '31' }, { colspan: 2, contents: '34' } ]
+					[ '00', '01', '[]02', '03', '04', '05' ],
+					[ '10', '11', { contents: '12', colspan: 2 }, '14', '15' ],
+					[ { contents: '20', colspan: 4 }, { contents: '24', colspan: 2 } ]
 				], { headingColumns: 4 } ) );
 
 				command.execute();
 
+				// +----+----+----+----+----+----+----+
+				// | 00 | 01 |    | 02 | 03 | 04 | 05 |
+				// +----+----+----+----+----+----+----+
+				// | 10 | 11 |    | 12      | 14 | 15 |
+				// +----+----+----+----+----+----+----+
+				// | 20                     | 24      |
+				// +----+----+----+----+----+----+----+
+				//                          ^-- heading columns
 				assertEqualMarkup( getData( model ), modelTable( [
-					[ '11', '12', '', '13[]', '14', '15' ],
-					[ '21', '22', '', { colspan: 2, contents: '23' }, '25' ],
-					[ { colspan: 5, contents: '31' }, { colspan: 2, contents: '34' } ]
+					[ '00', '01', '', '[]02', '03', '04', '05' ],
+					[ '10', '11', '', { contents: '12', colspan: 2 }, '14', '15' ],
+					[ { contents: '20', colspan: 5 }, { contents: '24', colspan: 2 } ]
 				], { headingColumns: 5 } ) );
 			} );
 		} );