|
|
@@ -24,56 +24,58 @@ describe( 'RemoveColumnCommand', () => {
|
|
|
let editor, model, command;
|
|
|
|
|
|
beforeEach( () => {
|
|
|
- return ModelTestEditor.create( {
|
|
|
- plugins: [ TableUtils ]
|
|
|
- } ).then( newEditor => {
|
|
|
- editor = newEditor;
|
|
|
- model = editor.model;
|
|
|
- command = new RemoveColumnCommand( editor );
|
|
|
-
|
|
|
- const conversion = editor.conversion;
|
|
|
- const schema = model.schema;
|
|
|
-
|
|
|
- schema.register( 'table', {
|
|
|
- allowWhere: '$block',
|
|
|
- allowAttributes: [ 'headingRows', 'headingColumns' ],
|
|
|
- isObject: true
|
|
|
- } );
|
|
|
+ return ModelTestEditor
|
|
|
+ .create( {
|
|
|
+ plugins: [ TableUtils ]
|
|
|
+ } )
|
|
|
+ .then( newEditor => {
|
|
|
+ editor = newEditor;
|
|
|
+ model = editor.model;
|
|
|
+ command = new RemoveColumnCommand( editor );
|
|
|
|
|
|
- schema.register( 'tableRow', { allowIn: 'table' } );
|
|
|
+ const conversion = editor.conversion;
|
|
|
+ const schema = model.schema;
|
|
|
|
|
|
- schema.register( 'tableCell', {
|
|
|
- allowIn: 'tableRow',
|
|
|
- allowContentOf: '$block',
|
|
|
- allowAttributes: [ 'colspan', 'rowspan' ],
|
|
|
- isLimit: true
|
|
|
- } );
|
|
|
+ schema.register( 'table', {
|
|
|
+ allowWhere: '$block',
|
|
|
+ allowAttributes: [ 'headingRows', 'headingColumns' ],
|
|
|
+ isObject: true
|
|
|
+ } );
|
|
|
|
|
|
- model.schema.register( 'p', { inheritAllFrom: '$block' } );
|
|
|
+ schema.register( 'tableRow', { allowIn: 'table' } );
|
|
|
|
|
|
- // Table conversion.
|
|
|
- conversion.for( 'upcast' ).add( upcastTable() );
|
|
|
- conversion.for( 'downcast' ).add( downcastInsertTable() );
|
|
|
+ schema.register( 'tableCell', {
|
|
|
+ allowIn: 'tableRow',
|
|
|
+ allowContentOf: '$block',
|
|
|
+ allowAttributes: [ 'colspan', 'rowspan' ],
|
|
|
+ isLimit: true
|
|
|
+ } );
|
|
|
|
|
|
- // Insert row conversion.
|
|
|
- conversion.for( 'downcast' ).add( downcastInsertRow() );
|
|
|
+ model.schema.register( 'p', { inheritAllFrom: '$block' } );
|
|
|
|
|
|
- // Remove row conversion.
|
|
|
- conversion.for( 'downcast' ).add( downcastRemoveRow() );
|
|
|
+ // Table conversion.
|
|
|
+ conversion.for( 'upcast' ).add( upcastTable() );
|
|
|
+ conversion.for( 'downcast' ).add( downcastInsertTable() );
|
|
|
|
|
|
- // Table cell conversion.
|
|
|
- conversion.for( 'downcast' ).add( downcastInsertCell() );
|
|
|
+ // Insert row conversion.
|
|
|
+ conversion.for( 'downcast' ).add( downcastInsertRow() );
|
|
|
|
|
|
- conversion.for( 'upcast' ).add( upcastElementToElement( { model: 'tableCell', view: 'td' } ) );
|
|
|
- conversion.for( 'upcast' ).add( upcastElementToElement( { model: 'tableCell', view: 'th' } ) );
|
|
|
+ // Remove row conversion.
|
|
|
+ conversion.for( 'downcast' ).add( downcastRemoveRow() );
|
|
|
|
|
|
- // Table attributes conversion.
|
|
|
- conversion.attributeToAttribute( { model: 'colspan', view: 'colspan' } );
|
|
|
- conversion.attributeToAttribute( { model: 'rowspan', view: 'rowspan' } );
|
|
|
+ // Table cell conversion.
|
|
|
+ conversion.for( 'downcast' ).add( downcastInsertCell() );
|
|
|
|
|
|
- conversion.for( 'downcast' ).add( downcastTableHeadingColumnsChange() );
|
|
|
- conversion.for( 'downcast' ).add( downcastTableHeadingRowsChange() );
|
|
|
- } );
|
|
|
+ conversion.for( 'upcast' ).add( upcastElementToElement( { model: 'tableCell', view: 'td' } ) );
|
|
|
+ conversion.for( 'upcast' ).add( upcastElementToElement( { model: 'tableCell', view: 'th' } ) );
|
|
|
+
|
|
|
+ // Table attributes conversion.
|
|
|
+ conversion.attributeToAttribute( { model: 'colspan', view: 'colspan' } );
|
|
|
+ conversion.attributeToAttribute( { model: 'rowspan', view: 'rowspan' } );
|
|
|
+
|
|
|
+ conversion.for( 'downcast' ).add( downcastTableHeadingColumnsChange() );
|
|
|
+ conversion.for( 'downcast' ).add( downcastTableHeadingRowsChange() );
|
|
|
+ } );
|
|
|
} );
|
|
|
|
|
|
afterEach( () => {
|