|
@@ -7,9 +7,11 @@ import ModelTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/modeltestedit
|
|
|
import { getData, setData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model';
|
|
import { getData, setData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model';
|
|
|
|
|
|
|
|
import MergeCellCommand from '../../src/commands/mergecellcommand';
|
|
import MergeCellCommand from '../../src/commands/mergecellcommand';
|
|
|
-import { defaultConversion, defaultSchema, modelTable } from '../_utils/utils';
|
|
|
|
|
|
|
+import { modelTable } from '../_utils/utils';
|
|
|
import TableUtils from '../../src/tableutils';
|
|
import TableUtils from '../../src/tableutils';
|
|
|
import { assertEqualMarkup } from '@ckeditor/ckeditor5-utils/tests/_utils/utils';
|
|
import { assertEqualMarkup } from '@ckeditor/ckeditor5-utils/tests/_utils/utils';
|
|
|
|
|
+import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
|
|
|
|
|
+import TableEditing from '../../src/tableediting';
|
|
|
|
|
|
|
|
describe( 'MergeCellCommand', () => {
|
|
describe( 'MergeCellCommand', () => {
|
|
|
let editor, model, command, root;
|
|
let editor, model, command, root;
|
|
@@ -17,15 +19,12 @@ describe( 'MergeCellCommand', () => {
|
|
|
beforeEach( () => {
|
|
beforeEach( () => {
|
|
|
return ModelTestEditor
|
|
return ModelTestEditor
|
|
|
.create( {
|
|
.create( {
|
|
|
- plugins: [ TableUtils ]
|
|
|
|
|
|
|
+ plugins: [ Paragraph, TableEditing, TableUtils ]
|
|
|
} )
|
|
} )
|
|
|
.then( newEditor => {
|
|
.then( newEditor => {
|
|
|
editor = newEditor;
|
|
editor = newEditor;
|
|
|
model = editor.model;
|
|
model = editor.model;
|
|
|
root = model.document.getRoot( 'main' );
|
|
root = model.document.getRoot( 'main' );
|
|
|
-
|
|
|
|
|
- defaultSchema( model.schema );
|
|
|
|
|
- defaultConversion( editor.conversion );
|
|
|
|
|
} );
|
|
} );
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
@@ -65,7 +64,9 @@ describe( 'MergeCellCommand', () => {
|
|
|
|
|
|
|
|
it( 'should be false if in a cell that has sibling but with different rowspan', () => {
|
|
it( 'should be false if in a cell that has sibling but with different rowspan', () => {
|
|
|
setData( model, modelTable( [
|
|
setData( model, modelTable( [
|
|
|
- [ { rowspan: 2, contents: '00[]' }, { rowspan: 3, contents: '01' } ]
|
|
|
|
|
|
|
+ [ { rowspan: 2, contents: '00[]' }, { rowspan: 3, contents: '01' }, '02' ],
|
|
|
|
|
+ [ '12' ],
|
|
|
|
|
+ [ '20', '22' ]
|
|
|
] ) );
|
|
] ) );
|
|
|
|
|
|
|
|
expect( command.isEnabled ).to.be.false;
|
|
expect( command.isEnabled ).to.be.false;
|
|
@@ -173,7 +174,9 @@ describe( 'MergeCellCommand', () => {
|
|
|
|
|
|
|
|
it( 'should be undefined if in a cell that has sibling but with different rowspan', () => {
|
|
it( 'should be undefined if in a cell that has sibling but with different rowspan', () => {
|
|
|
setData( model, modelTable( [
|
|
setData( model, modelTable( [
|
|
|
- [ { rowspan: 2, contents: '00[]' }, { rowspan: 3, contents: '01' } ]
|
|
|
|
|
|
|
+ [ { rowspan: 2, contents: '00[]' }, { rowspan: 3, contents: '01' }, '02' ],
|
|
|
|
|
+ [ '12' ],
|
|
|
|
|
+ [ '20', '22' ]
|
|
|
] ) );
|
|
] ) );
|
|
|
|
|
|
|
|
expect( command.value ).to.be.undefined;
|
|
expect( command.value ).to.be.undefined;
|
|
@@ -309,7 +312,9 @@ describe( 'MergeCellCommand', () => {
|
|
|
|
|
|
|
|
it( 'should be false if in a cell that has sibling but with different rowspan', () => {
|
|
it( 'should be false if in a cell that has sibling but with different rowspan', () => {
|
|
|
setData( model, modelTable( [
|
|
setData( model, modelTable( [
|
|
|
- [ { rowspan: 2, contents: '00' }, { rowspan: 3, contents: '01[]' } ]
|
|
|
|
|
|
|
+ [ { rowspan: 2, contents: '00' }, { rowspan: 3, contents: '01[]' } ],
|
|
|
|
|
+ [ '12' ],
|
|
|
|
|
+ [ '20', '22' ]
|
|
|
] ) );
|
|
] ) );
|
|
|
|
|
|
|
|
expect( command.isEnabled ).to.be.false;
|
|
expect( command.isEnabled ).to.be.false;
|
|
@@ -409,7 +414,9 @@ describe( 'MergeCellCommand', () => {
|
|
|
|
|
|
|
|
it( 'should be undefined if in a cell that has sibling but with different rowspan', () => {
|
|
it( 'should be undefined if in a cell that has sibling but with different rowspan', () => {
|
|
|
setData( model, modelTable( [
|
|
setData( model, modelTable( [
|
|
|
- [ { rowspan: 2, contents: '00' }, { rowspan: 3, contents: '01[]' } ]
|
|
|
|
|
|
|
+ [ { rowspan: 2, contents: '00' }, { rowspan: 3, contents: '01[]' } ],
|
|
|
|
|
+ [ '12' ],
|
|
|
|
|
+ [ '20', '22' ]
|
|
|
] ) );
|
|
] ) );
|
|
|
|
|
|
|
|
expect( command.value ).to.be.undefined;
|
|
expect( command.value ).to.be.undefined;
|