|
|
@@ -5,6 +5,7 @@
|
|
|
|
|
|
import VirtualTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/virtualtesteditor';
|
|
|
import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
|
|
|
+import UndoEditing from '@ckeditor/ckeditor5-undo/src/undoediting';
|
|
|
import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';
|
|
|
import { getData as getViewData } from '@ckeditor/ckeditor5-engine/src/dev-utils/view';
|
|
|
import { setData as setModelData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model';
|
|
|
@@ -19,7 +20,7 @@ describe( 'downcast converters', () => {
|
|
|
testUtils.createSinonSandbox();
|
|
|
|
|
|
beforeEach( async () => {
|
|
|
- editor = await VirtualTestEditor.create( { plugins: [ Paragraph, TableEditing ] } );
|
|
|
+ editor = await VirtualTestEditor.create( { plugins: [ Paragraph, TableEditing, UndoEditing ] } );
|
|
|
|
|
|
model = editor.model;
|
|
|
root = model.document.getRoot( 'main' );
|
|
|
@@ -840,8 +841,10 @@ describe( 'downcast converters', () => {
|
|
|
} );
|
|
|
} );
|
|
|
|
|
|
- describe( 'downcastTableHeadingRowsChange()', () => {
|
|
|
+ describe( 'downcastTableHeadingRowsChange', () => {
|
|
|
// The heading rows change downcast conversion is not executed in data pipeline.
|
|
|
+ // Note that headingRows table attribute triggers whole table downcast.
|
|
|
+
|
|
|
describe( 'editing pipeline', () => {
|
|
|
it( 'should work for adding heading rows', () => {
|
|
|
setModelData( model, modelTable( [
|
|
|
@@ -1017,6 +1020,34 @@ describe( 'downcast converters', () => {
|
|
|
'</figure>'
|
|
|
);
|
|
|
} );
|
|
|
+
|
|
|
+ it( 'should properly integrate with undo', () => {
|
|
|
+ setModelData( model, modelTable( [
|
|
|
+ [ '00', '01' ],
|
|
|
+ [ '10', '11' ],
|
|
|
+ [ '20', '21' ]
|
|
|
+ ], { headingRows: 1 } ) );
|
|
|
+
|
|
|
+ const table = root.getChild( 0 );
|
|
|
+
|
|
|
+ model.change( writer => {
|
|
|
+ writer.setAttribute( 'headingRows', 2, table );
|
|
|
+ } );
|
|
|
+
|
|
|
+ assertEqualMarkup( getViewData( view, { withoutSelection: true } ), viewTable( [
|
|
|
+ [ '00', '01' ],
|
|
|
+ [ '10', '11' ],
|
|
|
+ [ '20', '21' ]
|
|
|
+ ], { headingRows: 2, asWidget: true } ) );
|
|
|
+
|
|
|
+ editor.execute( 'undo' );
|
|
|
+
|
|
|
+ assertEqualMarkup( getViewData( view, { withoutSelection: true } ), viewTable( [
|
|
|
+ [ '00', '01' ],
|
|
|
+ [ '10', '11' ],
|
|
|
+ [ '20', '21' ]
|
|
|
+ ], { headingRows: 1, asWidget: true } ) );
|
|
|
+ } );
|
|
|
} );
|
|
|
} );
|
|
|
|