Browse Source

Remove custom table formatting utils in favor of assertEqualMarkup().

Maciej Gołaszewski 6 years ago
parent
commit
a7f398b36b

+ 0 - 44
packages/ckeditor5-table/tests/_utils/utils.js

@@ -114,50 +114,6 @@ export function viewTable( tableData, attributes = {} ) {
 	return `<figure ${ figureAttributes }>${ asWidget ? widgetHandler : '' }<table>${ thead }${ tbody }</table></figure>`;
 	return `<figure ${ figureAttributes }>${ asWidget ? widgetHandler : '' }<table>${ thead }${ tbody }</table></figure>`;
 }
 }
 
 
-/**
- * Formats model or view table - useful for chai assertions debugging.
- *
- * @param {String} tableString
- * @returns {String}
- */
-export function formatTable( tableString ) {
-	return tableString
-		.replace( /<tableRow>/g, '\n<tableRow>\n    ' )
-		.replace( /<thead>/g, '\n<thead>\n    ' )
-		.replace( /<tbody>/g, '\n<tbody>\n    ' )
-		.replace( /<tr>/g, '\n<tr>\n    ' )
-		.replace( /<\/tableRow>/g, '\n</tableRow>' )
-		.replace( /<\/thead>/g, '\n</thead>' )
-		.replace( /<\/tbody>/g, '\n</tbody>' )
-		.replace( /<\/tr>/g, '\n</tr>' )
-		.replace( /<\/table>/g, '\n</table>' )
-		.replace( /<\/figure>/g, '\n</figure>' );
-}
-
-/**
- * Returns formatted model table string.
- *
- * @param {Array.<String>} tableData
- * @param {Object} [attributes]
- * @returns {String}
- */
-export function formattedModelTable( tableData, attributes ) {
-	const tableString = modelTable( tableData, attributes );
-
-	return formatTable( tableString );
-}
-
-/**
- * Returns formatted view table string.
- *
- * @param {Array.<String>} tableData
- * @param {Object} [attributes]
- * @returns {String}
- */
-export function formattedViewTable( tableData, attributes ) {
-	return formatTable( viewTable( tableData, attributes ) );
-}
-
 export function defaultSchema( schema, registerParagraph = true ) {
 export function defaultSchema( schema, registerParagraph = true ) {
 	schema.register( 'table', {
 	schema.register( 'table', {
 		allowWhere: '$block',
 		allowWhere: '$block',

+ 16 - 15
packages/ckeditor5-table/tests/commands/insertcolumncommand.js

@@ -7,8 +7,9 @@ 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 InsertColumnCommand from '../../src/commands/insertcolumncommand';
 import InsertColumnCommand from '../../src/commands/insertcolumncommand';
-import { defaultConversion, defaultSchema, formatTable, formattedModelTable, modelTable } from '../_utils/utils';
+import { defaultConversion, defaultSchema, modelTable } from '../_utils/utils';
 import TableUtils from '../../src/tableutils';
 import TableUtils from '../../src/tableutils';
+import { assertEqualMarkup } from '@ckeditor/ckeditor5-utils/tests/_utils/utils';
 
 
 describe( 'InsertColumnCommand', () => {
 describe( 'InsertColumnCommand', () => {
 	let editor, model, command;
 	let editor, model, command;
@@ -57,7 +58,7 @@ describe( 'InsertColumnCommand', () => {
 
 
 				command.execute();
 				command.execute();
 
 
-				expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+				assertEqualMarkup( getData( model ), modelTable( [
 					[ '11[]', '', '12' ],
 					[ '11[]', '', '12' ],
 					[ '21', '', '22' ]
 					[ '21', '', '22' ]
 				] ) );
 				] ) );
@@ -70,7 +71,7 @@ describe( 'InsertColumnCommand', () => {
 
 
 				command.execute();
 				command.execute();
 
 
-				expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+				assertEqualMarkup( getData( model ), modelTable( [
 					[ '11', '<paragraph>12[]</paragraph>', '', '13' ]
 					[ '11', '<paragraph>12[]</paragraph>', '', '13' ]
 				] ) );
 				] ) );
 			} );
 			} );
@@ -83,7 +84,7 @@ describe( 'InsertColumnCommand', () => {
 
 
 				command.execute();
 				command.execute();
 
 
-				expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+				assertEqualMarkup( getData( model ), modelTable( [
 					[ '11', '12', '' ],
 					[ '11', '12', '' ],
 					[ '21', '22[]', '' ]
 					[ '21', '22[]', '' ]
 				] ) );
 				] ) );
@@ -98,7 +99,7 @@ describe( 'InsertColumnCommand', () => {
 
 
 				command.execute();
 				command.execute();
 
 
-				expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+				assertEqualMarkup( getData( model ), modelTable( [
 					[ '11[]', '', '12' ],
 					[ '11[]', '', '12' ],
 					[ '21', '', '22' ],
 					[ '21', '', '22' ],
 					[ '31', '', '32' ]
 					[ '31', '', '32' ]
@@ -114,7 +115,7 @@ describe( 'InsertColumnCommand', () => {
 
 
 				command.execute();
 				command.execute();
 
 
-				expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+				assertEqualMarkup( getData( model ), modelTable( [
 					[ '11', '12[]', '', '13' ],
 					[ '11', '12[]', '', '13' ],
 					[ '21', '22', '', '23' ],
 					[ '21', '22', '', '23' ],
 					[ '31', '32', '', '33' ]
 					[ '31', '32', '', '33' ]
@@ -130,7 +131,7 @@ describe( 'InsertColumnCommand', () => {
 
 
 				command.execute();
 				command.execute();
 
 
-				expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+				assertEqualMarkup( getData( model ), modelTable( [
 					[ '11[]', '', '12' ],
 					[ '11[]', '', '12' ],
 					[ { colspan: 3, contents: '21' } ],
 					[ { colspan: 3, contents: '21' } ],
 					[ '31', '', '32' ]
 					[ '31', '', '32' ]
@@ -146,7 +147,7 @@ describe( 'InsertColumnCommand', () => {
 
 
 				command.execute();
 				command.execute();
 
 
-				expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+				assertEqualMarkup( getData( model ), modelTable( [
 					[ '11', '12[]', '', '13', '14', '15' ],
 					[ '11', '12[]', '', '13', '14', '15' ],
 					[ '21', '22', '', { colspan: 2, contents: '23' }, '25' ],
 					[ '21', '22', '', { colspan: 2, contents: '23' }, '25' ],
 					[ { colspan: 5, contents: '31' }, { colspan: 2, contents: '34' } ]
 					[ { colspan: 5, contents: '31' }, { colspan: 2, contents: '34' } ]
@@ -181,7 +182,7 @@ describe( 'InsertColumnCommand', () => {
 
 
 				command.execute();
 				command.execute();
 
 
-				expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+				assertEqualMarkup( getData( model ), modelTable( [
 					[ '11', '', '12[]' ],
 					[ '11', '', '12[]' ],
 					[ '21', '', '22' ]
 					[ '21', '', '22' ]
 				] ) );
 				] ) );
@@ -194,7 +195,7 @@ describe( 'InsertColumnCommand', () => {
 
 
 				command.execute();
 				command.execute();
 
 
-				expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+				assertEqualMarkup( getData( model ), modelTable( [
 					[ '11', '', '<paragraph>12[]</paragraph>', '13' ]
 					[ '11', '', '<paragraph>12[]</paragraph>', '13' ]
 				] ) );
 				] ) );
 			} );
 			} );
@@ -207,7 +208,7 @@ describe( 'InsertColumnCommand', () => {
 
 
 				command.execute();
 				command.execute();
 
 
-				expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+				assertEqualMarkup( getData( model ), modelTable( [
 					[ '', '11', '12' ],
 					[ '', '11', '12' ],
 					[ '', '[]21', '22' ]
 					[ '', '[]21', '22' ]
 				] ) );
 				] ) );
@@ -222,7 +223,7 @@ describe( 'InsertColumnCommand', () => {
 
 
 				command.execute();
 				command.execute();
 
 
-				expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+				assertEqualMarkup( getData( model ), modelTable( [
 					[ '11', '', '12[]' ],
 					[ '11', '', '12[]' ],
 					[ '21', '', '22' ],
 					[ '21', '', '22' ],
 					[ '31', '', '32' ]
 					[ '31', '', '32' ]
@@ -238,7 +239,7 @@ describe( 'InsertColumnCommand', () => {
 
 
 				command.execute();
 				command.execute();
 
 
-				expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+				assertEqualMarkup( getData( model ), modelTable( [
 					[ '11', '12', '', '13[]' ],
 					[ '11', '12', '', '13[]' ],
 					[ '21', '22', '', '23' ],
 					[ '21', '22', '', '23' ],
 					[ '31', '32', '', '33' ]
 					[ '31', '32', '', '33' ]
@@ -254,7 +255,7 @@ describe( 'InsertColumnCommand', () => {
 
 
 				command.execute();
 				command.execute();
 
 
-				expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+				assertEqualMarkup( getData( model ), modelTable( [
 					[ '11', '', '12[]' ],
 					[ '11', '', '12[]' ],
 					[ { colspan: 3, contents: '21' } ],
 					[ { colspan: 3, contents: '21' } ],
 					[ '31', '', '32' ]
 					[ '31', '', '32' ]
@@ -270,7 +271,7 @@ describe( 'InsertColumnCommand', () => {
 
 
 				command.execute();
 				command.execute();
 
 
-				expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+				assertEqualMarkup( getData( model ), modelTable( [
 					[ '11', '12', '', '13[]', '14', '15' ],
 					[ '11', '12', '', '13[]', '14', '15' ],
 					[ '21', '22', '', { colspan: 2, contents: '23' }, '25' ],
 					[ '21', '22', '', { colspan: 2, contents: '23' }, '25' ],
 					[ { colspan: 5, contents: '31' }, { colspan: 2, contents: '34' } ]
 					[ { colspan: 5, contents: '31' }, { colspan: 2, contents: '34' } ]

+ 15 - 14
packages/ckeditor5-table/tests/commands/insertrowcommand.js

@@ -7,8 +7,9 @@ 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 InsertRowCommand from '../../src/commands/insertrowcommand';
 import InsertRowCommand from '../../src/commands/insertrowcommand';
-import { defaultConversion, defaultSchema, formatTable, formattedModelTable, modelTable } from '../_utils/utils';
+import { defaultConversion, defaultSchema, modelTable } from '../_utils/utils';
 import TableUtils from '../../src/tableutils';
 import TableUtils from '../../src/tableutils';
+import { assertEqualMarkup } from '@ckeditor/ckeditor5-utils/tests/_utils/utils';
 
 
 describe( 'InsertRowCommand', () => {
 describe( 'InsertRowCommand', () => {
 	let editor, model, command;
 	let editor, model, command;
@@ -57,7 +58,7 @@ describe( 'InsertRowCommand', () => {
 
 
 				command.execute();
 				command.execute();
 
 
-				expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+				assertEqualMarkup( getData( model ), modelTable( [
 					[ '00[]', '01' ],
 					[ '00[]', '01' ],
 					[ '', '' ],
 					[ '', '' ],
 					[ '10', '11' ]
 					[ '10', '11' ]
@@ -73,7 +74,7 @@ describe( 'InsertRowCommand', () => {
 
 
 				command.execute();
 				command.execute();
 
 
-				expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+				assertEqualMarkup( getData( model ), modelTable( [
 					[ '00' ],
 					[ '00' ],
 					[ '<paragraph>[]10</paragraph>' ],
 					[ '<paragraph>[]10</paragraph>' ],
 					[ '' ],
 					[ '' ],
@@ -90,7 +91,7 @@ describe( 'InsertRowCommand', () => {
 
 
 				command.execute();
 				command.execute();
 
 
-				expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+				assertEqualMarkup( getData( model ), modelTable( [
 					[ '00[]', '01' ],
 					[ '00[]', '01' ],
 					[ '', '' ],
 					[ '', '' ],
 					[ '10', '11' ],
 					[ '10', '11' ],
@@ -107,7 +108,7 @@ describe( 'InsertRowCommand', () => {
 
 
 				command.execute();
 				command.execute();
 
 
-				expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+				assertEqualMarkup( getData( model ), modelTable( [
 					[ '00', '01' ],
 					[ '00', '01' ],
 					[ '10[]', '11' ],
 					[ '10[]', '11' ],
 					[ '', '' ],
 					[ '', '' ],
@@ -124,7 +125,7 @@ describe( 'InsertRowCommand', () => {
 
 
 				command.execute();
 				command.execute();
 
 
-				expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+				assertEqualMarkup( getData( model ), modelTable( [
 					[ { colspan: 2, contents: '00' }, '02', '03' ],
 					[ { colspan: 2, contents: '00' }, '02', '03' ],
 					[ { colspan: 2, rowspan: 5, contents: '10[]' }, '12', '13' ],
 					[ { colspan: 2, rowspan: 5, contents: '10[]' }, '12', '13' ],
 					[ '', '' ],
 					[ '', '' ],
@@ -141,7 +142,7 @@ describe( 'InsertRowCommand', () => {
 
 
 				command.execute();
 				command.execute();
 
 
-				expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+				assertEqualMarkup( getData( model ), modelTable( [
 					[ { rowspan: 2, contents: '00' }, '01', '02' ],
 					[ { rowspan: 2, contents: '00' }, '01', '02' ],
 					[ '11[]', '12' ],
 					[ '11[]', '12' ],
 					[ '', '', '' ],
 					[ '', '', '' ],
@@ -158,7 +159,7 @@ describe( 'InsertRowCommand', () => {
 
 
 				command.execute();
 				command.execute();
 
 
-				expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+				assertEqualMarkup( getData( model ), modelTable( [
 					[ { rowspan: 2, contents: '00' }, '01', '02' ],
 					[ { rowspan: 2, contents: '00' }, '01', '02' ],
 					[ '11[]', '12' ],
 					[ '11[]', '12' ],
 					[ '', '', '' ],
 					[ '', '', '' ],
@@ -174,7 +175,7 @@ describe( 'InsertRowCommand', () => {
 
 
 				command.execute();
 				command.execute();
 
 
-				expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+				assertEqualMarkup( getData( model ), modelTable( [
 					[ '00', '01' ],
 					[ '00', '01' ],
 					[ '10[]', '11' ],
 					[ '10[]', '11' ],
 					[ '', '' ]
 					[ '', '' ]
@@ -210,7 +211,7 @@ describe( 'InsertRowCommand', () => {
 
 
 				command.execute();
 				command.execute();
 
 
-				expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+				assertEqualMarkup( getData( model ), modelTable( [
 					[ '00' ],
 					[ '00' ],
 					[ '' ],
 					[ '' ],
 					[ '<paragraph>[]10</paragraph>' ],
 					[ '<paragraph>[]10</paragraph>' ],
@@ -226,7 +227,7 @@ describe( 'InsertRowCommand', () => {
 
 
 				command.execute();
 				command.execute();
 
 
-				expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+				assertEqualMarkup( getData( model ), modelTable( [
 					[ '', '' ],
 					[ '', '' ],
 					[ '00[]', '01' ],
 					[ '00[]', '01' ],
 					[ '10', '11' ]
 					[ '10', '11' ]
@@ -242,7 +243,7 @@ describe( 'InsertRowCommand', () => {
 
 
 				command.execute();
 				command.execute();
 
 
-				expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+				assertEqualMarkup( getData( model ), modelTable( [
 					[ '00', '01' ],
 					[ '00', '01' ],
 					[ '10', '11' ],
 					[ '10', '11' ],
 					[ '', '' ],
 					[ '', '' ],
@@ -259,7 +260,7 @@ describe( 'InsertRowCommand', () => {
 
 
 				command.execute();
 				command.execute();
 
 
-				expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+				assertEqualMarkup( getData( model ), modelTable( [
 					[ '', '' ],
 					[ '', '' ],
 					[ '00[]', '01' ],
 					[ '00[]', '01' ],
 					[ '10', '11' ],
 					[ '10', '11' ],
@@ -276,7 +277,7 @@ describe( 'InsertRowCommand', () => {
 
 
 				command.execute();
 				command.execute();
 
 
-				expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+				assertEqualMarkup( getData( model ), modelTable( [
 					[ '00', '01' ],
 					[ '00', '01' ],
 					[ '10', '11' ],
 					[ '10', '11' ],
 					[ '', '' ],
 					[ '', '' ],

+ 11 - 10
packages/ckeditor5-table/tests/commands/inserttablecommand.js

@@ -9,7 +9,8 @@ import { getData, setData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model
 import InsertTableCommand from '../../src/commands/inserttablecommand';
 import InsertTableCommand from '../../src/commands/inserttablecommand';
 import TableUtils from '../../src/tableutils';
 import TableUtils from '../../src/tableutils';
 
 
-import { defaultConversion, defaultSchema, formatTable, formattedModelTable } from '../_utils/utils';
+import { defaultConversion, defaultSchema, modelTable } from '../_utils/utils';
+import { assertEqualMarkup } from '@ckeditor/ckeditor5-utils/tests/_utils/utils';
 
 
 describe( 'InsertTableCommand', () => {
 describe( 'InsertTableCommand', () => {
 	let editor, model, command;
 	let editor, model, command;
@@ -66,7 +67,7 @@ describe( 'InsertTableCommand', () => {
 
 
 				command.execute();
 				command.execute();
 
 
-				expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+				assertEqualMarkup( getData( model ), modelTable( [
 					[ '[]', '' ],
 					[ '[]', '' ],
 					[ '', '' ]
 					[ '', '' ]
 				] ) );
 				] ) );
@@ -77,9 +78,9 @@ describe( 'InsertTableCommand', () => {
 
 
 				command.execute();
 				command.execute();
 
 
-				expect( formatTable( getData( model ) ) ).to.equal(
+				assertEqualMarkup( getData( model ),
 					'<paragraph>foo</paragraph>' +
 					'<paragraph>foo</paragraph>' +
-					formattedModelTable( [
+					modelTable( [
 						[ '[]', '' ],
 						[ '[]', '' ],
 						[ '', '' ]
 						[ '', '' ]
 					] )
 					] )
@@ -91,9 +92,9 @@ describe( 'InsertTableCommand', () => {
 
 
 				command.execute( { rows: 3, columns: 4 } );
 				command.execute( { rows: 3, columns: 4 } );
 
 
-				expect( formatTable( getData( model ) ) ).to.equal(
+				assertEqualMarkup( getData( model ),
 					'<paragraph>foo</paragraph>' +
 					'<paragraph>foo</paragraph>' +
-					formattedModelTable( [
+					modelTable( [
 						[ '[]', '', '', '' ],
 						[ '[]', '', '', '' ],
 						[ '', '', '', '' ],
 						[ '', '', '', '' ],
 						[ '', '', '', '' ]
 						[ '', '', '', '' ]
@@ -106,8 +107,8 @@ describe( 'InsertTableCommand', () => {
 
 
 				command.execute();
 				command.execute();
 
 
-				expect( formatTable( getData( model ) ) ).to.equal(
-					formattedModelTable( [
+				assertEqualMarkup( getData( model ),
+					modelTable( [
 						[ '[]', '' ],
 						[ '[]', '' ],
 						[ '', '' ]
 						[ '', '' ]
 					] ) +
 					] ) +
@@ -120,8 +121,8 @@ describe( 'InsertTableCommand', () => {
 
 
 				command.execute( { rows: 3, columns: 4 } );
 				command.execute( { rows: 3, columns: 4 } );
 
 
-				expect( formatTable( getData( model ) ) ).to.equal(
-					formattedModelTable( [
+				assertEqualMarkup( getData( model ),
+					modelTable( [
 						[ '[]', '', '', '' ],
 						[ '[]', '', '', '' ],
 						[ '', '', '', '' ],
 						[ '', '', '', '' ],
 						[ '', '', '', '' ]
 						[ '', '', '', '' ]

+ 27 - 26
packages/ckeditor5-table/tests/commands/mergecellcommand.js

@@ -7,8 +7,9 @@ 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, formatTable, formattedModelTable, modelTable } from '../_utils/utils';
+import { defaultConversion, defaultSchema, modelTable } from '../_utils/utils';
 import TableUtils from '../../src/tableutils';
 import TableUtils from '../../src/tableutils';
+import { assertEqualMarkup } from '@ckeditor/ckeditor5-utils/tests/_utils/utils';
 
 
 describe( 'MergeCellCommand', () => {
 describe( 'MergeCellCommand', () => {
 	let editor, model, command, root;
 	let editor, model, command, root;
@@ -151,7 +152,7 @@ describe( 'MergeCellCommand', () => {
 
 
 				command.execute();
 				command.execute();
 
 
-				expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+				assertEqualMarkup( getData( model ), modelTable( [
 					[ { colspan: 2, contents: '<paragraph>[00</paragraph><paragraph>01]</paragraph>' } ]
 					[ { colspan: 2, contents: '<paragraph>[00</paragraph><paragraph>01]</paragraph>' } ]
 				] ) );
 				] ) );
 			} );
 			} );
@@ -163,7 +164,7 @@ describe( 'MergeCellCommand', () => {
 
 
 				command.execute();
 				command.execute();
 
 
-				expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+				assertEqualMarkup( getData( model ), modelTable( [
 					[ { colspan: 2, contents: '<paragraph>[]</paragraph>' } ]
 					[ { colspan: 2, contents: '<paragraph>[]</paragraph>' } ]
 				] ) );
 				] ) );
 			} );
 			} );
@@ -175,7 +176,7 @@ describe( 'MergeCellCommand', () => {
 
 
 				command.execute();
 				command.execute();
 
 
-				expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+				assertEqualMarkup( getData( model ), modelTable( [
 					[ { colspan: 2, contents: '<paragraph>[foo]</paragraph>' } ]
 					[ { colspan: 2, contents: '<paragraph>[foo]</paragraph>' } ]
 				] ) );
 				] ) );
 			} );
 			} );
@@ -187,7 +188,7 @@ describe( 'MergeCellCommand', () => {
 
 
 				command.execute();
 				command.execute();
 
 
-				expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+				assertEqualMarkup( getData( model ), modelTable( [
 					[ { colspan: 2, contents: '<paragraph>[foo]</paragraph>' } ]
 					[ { colspan: 2, contents: '<paragraph>[foo]</paragraph>' } ]
 				] ) );
 				] ) );
 			} );
 			} );
@@ -205,7 +206,7 @@ describe( 'MergeCellCommand', () => {
 
 
 				command.execute();
 				command.execute();
 
 
-				expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+				assertEqualMarkup( getData( model ), modelTable( [
 					[ { colspan: 2, contents: '<block>[</block><block>]</block>' } ]
 					[ { colspan: 2, contents: '<block>[</block><block>]</block>' } ]
 				] ) );
 				] ) );
 			} );
 			} );
@@ -331,7 +332,7 @@ describe( 'MergeCellCommand', () => {
 
 
 				command.execute();
 				command.execute();
 
 
-				expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+				assertEqualMarkup( getData( model ), modelTable( [
 					[ { colspan: 2, contents: '<paragraph>[00</paragraph><paragraph>01]</paragraph>' } ]
 					[ { colspan: 2, contents: '<paragraph>[00</paragraph><paragraph>01]</paragraph>' } ]
 				] ) );
 				] ) );
 			} );
 			} );
@@ -343,7 +344,7 @@ describe( 'MergeCellCommand', () => {
 
 
 				command.execute();
 				command.execute();
 
 
-				expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+				assertEqualMarkup( getData( model ), modelTable( [
 					[ { colspan: 2, contents: '<paragraph>[]</paragraph>' } ]
 					[ { colspan: 2, contents: '<paragraph>[]</paragraph>' } ]
 				] ) );
 				] ) );
 			} );
 			} );
@@ -355,7 +356,7 @@ describe( 'MergeCellCommand', () => {
 
 
 				command.execute();
 				command.execute();
 
 
-				expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+				assertEqualMarkup( getData( model ), modelTable( [
 					[ { colspan: 2, contents: '<paragraph>[foo]</paragraph>' } ]
 					[ { colspan: 2, contents: '<paragraph>[foo]</paragraph>' } ]
 				] ) );
 				] ) );
 			} );
 			} );
@@ -367,7 +368,7 @@ describe( 'MergeCellCommand', () => {
 
 
 				command.execute();
 				command.execute();
 
 
-				expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+				assertEqualMarkup( getData( model ), modelTable( [
 					[ { colspan: 2, contents: '<paragraph>[foo]</paragraph>' } ]
 					[ { colspan: 2, contents: '<paragraph>[foo]</paragraph>' } ]
 				] ) );
 				] ) );
 			} );
 			} );
@@ -385,7 +386,7 @@ describe( 'MergeCellCommand', () => {
 
 
 				command.execute();
 				command.execute();
 
 
-				expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+				assertEqualMarkup( getData( model ), modelTable( [
 					[ { colspan: 2, contents: '<block>[</block><block>]</block>' } ]
 					[ { colspan: 2, contents: '<block>[</block><block>]</block>' } ]
 				] ) );
 				] ) );
 			} );
 			} );
@@ -523,7 +524,7 @@ describe( 'MergeCellCommand', () => {
 
 
 				command.execute();
 				command.execute();
 
 
-				expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+				assertEqualMarkup( getData( model ), modelTable( [
 					[ '00', { rowspan: 2, contents: '<paragraph>[01</paragraph><paragraph>11]</paragraph>' } ],
 					[ '00', { rowspan: 2, contents: '<paragraph>[01</paragraph><paragraph>11]</paragraph>' } ],
 					[ '10' ]
 					[ '10' ]
 				] ) );
 				] ) );
@@ -537,7 +538,7 @@ describe( 'MergeCellCommand', () => {
 
 
 				command.execute();
 				command.execute();
 
 
-				expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+				assertEqualMarkup( getData( model ), modelTable( [
 					[ { rowspan: 2, contents: '[]' }, '' ],
 					[ { rowspan: 2, contents: '[]' }, '' ],
 					[ '' ]
 					[ '' ]
 				] ) );
 				] ) );
@@ -551,7 +552,7 @@ describe( 'MergeCellCommand', () => {
 
 
 				command.execute();
 				command.execute();
 
 
-				expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+				assertEqualMarkup( getData( model ), modelTable( [
 					[ { rowspan: 2, contents: '[foo]' }, '' ],
 					[ { rowspan: 2, contents: '[foo]' }, '' ],
 					[ '' ]
 					[ '' ]
 				] ) );
 				] ) );
@@ -565,7 +566,7 @@ describe( 'MergeCellCommand', () => {
 
 
 				command.execute();
 				command.execute();
 
 
-				expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+				assertEqualMarkup( getData( model ), modelTable( [
 					[ { rowspan: 2, contents: '[foo]' }, '' ],
 					[ { rowspan: 2, contents: '[foo]' }, '' ],
 					[ '' ]
 					[ '' ]
 				] ) );
 				] ) );
@@ -585,7 +586,7 @@ describe( 'MergeCellCommand', () => {
 
 
 				command.execute();
 				command.execute();
 
 
-				expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+				assertEqualMarkup( getData( model ), modelTable( [
 					[ { rowspan: 2, contents: '<block>[</block><block>]</block>' }, '' ],
 					[ { rowspan: 2, contents: '<block>[</block><block>]</block>' }, '' ],
 					[ '' ]
 					[ '' ]
 				] ) );
 				] ) );
@@ -600,7 +601,7 @@ describe( 'MergeCellCommand', () => {
 
 
 				command.execute();
 				command.execute();
 
 
-				expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+				assertEqualMarkup( getData( model ), modelTable( [
 					[ '00', '<paragraph>[01</paragraph><paragraph>11]</paragraph>', { rowspan: 2, contents: '02' } ],
 					[ '00', '<paragraph>[01</paragraph><paragraph>11]</paragraph>', { rowspan: 2, contents: '02' } ],
 					[ '20', '21' ]
 					[ '20', '21' ]
 				] ) );
 				] ) );
@@ -617,7 +618,7 @@ describe( 'MergeCellCommand', () => {
 
 
 				command.execute();
 				command.execute();
 
 
-				expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+				assertEqualMarkup( getData( model ), modelTable( [
 					[ { rowspan: 2, contents: '00' }, '01', '02' ],
 					[ { rowspan: 2, contents: '00' }, '01', '02' ],
 					[ '11', '12' ],
 					[ '11', '12' ],
 					[ '20', '<paragraph>[21</paragraph><paragraph>31]</paragraph>', { rowspan: 2, contents: '22' } ],
 					[ '20', '<paragraph>[21</paragraph><paragraph>31]</paragraph>', { rowspan: 2, contents: '22' } ],
@@ -759,7 +760,7 @@ describe( 'MergeCellCommand', () => {
 
 
 				command.execute();
 				command.execute();
 
 
-				expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+				assertEqualMarkup( getData( model ), modelTable( [
 					[ '00', { rowspan: 2, contents: '<paragraph>[01</paragraph><paragraph>11]</paragraph>' } ],
 					[ '00', { rowspan: 2, contents: '<paragraph>[01</paragraph><paragraph>11]</paragraph>' } ],
 					[ '10' ]
 					[ '10' ]
 				] ) );
 				] ) );
@@ -773,7 +774,7 @@ describe( 'MergeCellCommand', () => {
 
 
 				command.execute();
 				command.execute();
 
 
-				expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+				assertEqualMarkup( getData( model ), modelTable( [
 					[ { rowspan: 2, contents: '[]' }, '' ],
 					[ { rowspan: 2, contents: '[]' }, '' ],
 					[ '' ]
 					[ '' ]
 				] ) );
 				] ) );
@@ -787,7 +788,7 @@ describe( 'MergeCellCommand', () => {
 
 
 				command.execute();
 				command.execute();
 
 
-				expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+				assertEqualMarkup( getData( model ), modelTable( [
 					[ { rowspan: 2, contents: '[foo]' }, '' ],
 					[ { rowspan: 2, contents: '[foo]' }, '' ],
 					[ '' ]
 					[ '' ]
 				] ) );
 				] ) );
@@ -801,7 +802,7 @@ describe( 'MergeCellCommand', () => {
 
 
 				command.execute();
 				command.execute();
 
 
-				expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+				assertEqualMarkup( getData( model ), modelTable( [
 					[ { rowspan: 2, contents: '[foo]' }, '' ],
 					[ { rowspan: 2, contents: '[foo]' }, '' ],
 					[ '' ]
 					[ '' ]
 				] ) );
 				] ) );
@@ -821,7 +822,7 @@ describe( 'MergeCellCommand', () => {
 
 
 				command.execute();
 				command.execute();
 
 
-				expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+				assertEqualMarkup( getData( model ), modelTable( [
 					[ { rowspan: 2, contents: '<block>[</block><block>]</block>' }, '' ],
 					[ { rowspan: 2, contents: '<block>[</block><block>]</block>' }, '' ],
 					[ '' ]
 					[ '' ]
 				] ) );
 				] ) );
@@ -837,7 +838,7 @@ describe( 'MergeCellCommand', () => {
 
 
 				command.execute();
 				command.execute();
 
 
-				expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+				assertEqualMarkup( getData( model ), modelTable( [
 					[ { rowspan: 3, contents: '00' }, '11', '12', '13' ],
 					[ { rowspan: 3, contents: '00' }, '11', '12', '13' ],
 					[
 					[
 						{ rowspan: 2, contents: '21' },
 						{ rowspan: 2, contents: '21' },
@@ -858,7 +859,7 @@ describe( 'MergeCellCommand', () => {
 
 
 				command.execute();
 				command.execute();
 
 
-				expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+				assertEqualMarkup( getData( model ), modelTable( [
 					[ '00', '<paragraph>[01</paragraph><paragraph>11]</paragraph>', { rowspan: 2, contents: '02' } ],
 					[ '00', '<paragraph>[01</paragraph><paragraph>11]</paragraph>', { rowspan: 2, contents: '02' } ],
 					[ '20', '21' ]
 					[ '20', '21' ]
 				] ) );
 				] ) );
@@ -875,7 +876,7 @@ describe( 'MergeCellCommand', () => {
 
 
 				command.execute();
 				command.execute();
 
 
-				expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+				assertEqualMarkup( getData( model ), modelTable( [
 					[ { rowspan: 2, contents: '00' }, '01', '02' ],
 					[ { rowspan: 2, contents: '00' }, '01', '02' ],
 					[ '11', '12' ],
 					[ '11', '12' ],
 					[ '20', '<paragraph>[21</paragraph><paragraph>31]</paragraph>', { rowspan: 2, contents: '22' } ],
 					[ '20', '<paragraph>[21</paragraph><paragraph>31]</paragraph>', { rowspan: 2, contents: '22' } ],

+ 7 - 6
packages/ckeditor5-table/tests/commands/removecolumncommand.js

@@ -7,8 +7,9 @@ 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 RemoveColumnCommand from '../../src/commands/removecolumncommand';
 import RemoveColumnCommand from '../../src/commands/removecolumncommand';
-import { defaultConversion, defaultSchema, formatTable, formattedModelTable, modelTable } from '../_utils/utils';
+import { defaultConversion, defaultSchema, modelTable } from '../_utils/utils';
 import TableUtils from '../../src/tableutils';
 import TableUtils from '../../src/tableutils';
+import { assertEqualMarkup } from '@ckeditor/ckeditor5-utils/tests/_utils/utils';
 
 
 describe( 'RemoveColumnCommand', () => {
 describe( 'RemoveColumnCommand', () => {
 	let editor, model, command;
 	let editor, model, command;
@@ -69,7 +70,7 @@ describe( 'RemoveColumnCommand', () => {
 
 
 			command.execute();
 			command.execute();
 
 
-			expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+			assertEqualMarkup( getData( model ), modelTable( [
 				[ '00', '02' ],
 				[ '00', '02' ],
 				[ '<paragraph>10[]</paragraph>', '12' ],
 				[ '<paragraph>10[]</paragraph>', '12' ],
 				[ '20', '22' ]
 				[ '20', '22' ]
@@ -85,7 +86,7 @@ describe( 'RemoveColumnCommand', () => {
 
 
 			command.execute();
 			command.execute();
 
 
-			expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+			assertEqualMarkup( getData( model ), modelTable( [
 				[ '<paragraph>[]01</paragraph>' ],
 				[ '<paragraph>[]01</paragraph>' ],
 				[ '11' ],
 				[ '11' ],
 				[ '21' ]
 				[ '21' ]
@@ -101,7 +102,7 @@ describe( 'RemoveColumnCommand', () => {
 
 
 			command.execute();
 			command.execute();
 
 
-			expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+			assertEqualMarkup( getData( model ), modelTable( [
 				[ '01' ],
 				[ '01' ],
 				[ '<paragraph>[]11</paragraph>' ],
 				[ '<paragraph>[]11</paragraph>' ],
 				[ '21' ]
 				[ '21' ]
@@ -119,7 +120,7 @@ describe( 'RemoveColumnCommand', () => {
 
 
 			command.execute();
 			command.execute();
 
 
-			expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+			assertEqualMarkup( getData( model ), modelTable( [
 				[ { colspan: 3, contents: '00' }, '03' ],
 				[ { colspan: 3, contents: '00' }, '03' ],
 				[ { colspan: 2, contents: '10' }, '13' ],
 				[ { colspan: 2, contents: '10' }, '13' ],
 				[ { colspan: 2, contents: '<paragraph>20[]</paragraph>' }, '23' ],
 				[ { colspan: 2, contents: '<paragraph>20[]</paragraph>' }, '23' ],
@@ -138,7 +139,7 @@ describe( 'RemoveColumnCommand', () => {
 
 
 			command.execute();
 			command.execute();
 
 
-			expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+			assertEqualMarkup( getData( model ), modelTable( [
 				[ { colspan: 2, contents: '[]00' }, '03' ],
 				[ { colspan: 2, contents: '[]00' }, '03' ],
 				[ '10', '13' ],
 				[ '10', '13' ],
 				[ '21', '22', '23' ]
 				[ '21', '22', '23' ]

+ 7 - 6
packages/ckeditor5-table/tests/commands/removerowcommand.js

@@ -7,7 +7,8 @@ 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 RemoveRowCommand from '../../src/commands/removerowcommand';
 import RemoveRowCommand from '../../src/commands/removerowcommand';
-import { defaultConversion, defaultSchema, formatTable, formattedModelTable, modelTable } from '../_utils/utils';
+import { defaultConversion, defaultSchema, modelTable } from '../_utils/utils';
+import { assertEqualMarkup } from '@ckeditor/ckeditor5-utils/tests/_utils/utils';
 
 
 describe( 'RemoveRowCommand', () => {
 describe( 'RemoveRowCommand', () => {
 	let editor, model, command;
 	let editor, model, command;
@@ -63,7 +64,7 @@ describe( 'RemoveRowCommand', () => {
 
 
 			command.execute();
 			command.execute();
 
 
-			expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+			assertEqualMarkup( getData( model ), modelTable( [
 				[ '00', '<paragraph>01[]</paragraph>' ],
 				[ '00', '<paragraph>01[]</paragraph>' ],
 				[ '20', '21' ]
 				[ '20', '21' ]
 			] ) );
 			] ) );
@@ -78,7 +79,7 @@ describe( 'RemoveRowCommand', () => {
 
 
 			command.execute();
 			command.execute();
 
 
-			expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+			assertEqualMarkup( getData( model ), modelTable( [
 				[ '<paragraph>[]10</paragraph>', '11' ],
 				[ '<paragraph>[]10</paragraph>', '11' ],
 				[ '20', '21' ]
 				[ '20', '21' ]
 			] ) );
 			] ) );
@@ -93,7 +94,7 @@ describe( 'RemoveRowCommand', () => {
 
 
 			command.execute();
 			command.execute();
 
 
-			expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+			assertEqualMarkup( getData( model ), modelTable( [
 				[ '00', '<paragraph>01[]</paragraph>' ],
 				[ '00', '<paragraph>01[]</paragraph>' ],
 				[ '20', '21' ]
 				[ '20', '21' ]
 			], { headingRows: 1 } ) );
 			], { headingRows: 1 } ) );
@@ -109,7 +110,7 @@ describe( 'RemoveRowCommand', () => {
 
 
 			command.execute();
 			command.execute();
 
 
-			expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+			assertEqualMarkup( getData( model ), modelTable( [
 				[ { rowspan: 3, contents: '00' }, { rowspan: 2, contents: '01' }, { rowspan: 2, contents: '02' }, '03', '04' ],
 				[ { rowspan: 3, contents: '00' }, { rowspan: 2, contents: '01' }, { rowspan: 2, contents: '02' }, '03', '04' ],
 				[ '13', '<paragraph>14[]</paragraph>' ],
 				[ '13', '<paragraph>14[]</paragraph>' ],
 				[ '30', '31', '32', '33', '34' ]
 				[ '30', '31', '32', '33', '34' ]
@@ -126,7 +127,7 @@ describe( 'RemoveRowCommand', () => {
 
 
 			command.execute();
 			command.execute();
 
 
-			expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+			assertEqualMarkup( getData( model ), modelTable( [
 				[ { rowspan: 2, contents: '[]00' }, '01', '12' ],
 				[ { rowspan: 2, contents: '[]00' }, '01', '12' ],
 				[ '22' ],
 				[ '22' ],
 				[ '30', '31', '32' ]
 				[ '30', '31', '32' ]

+ 8 - 7
packages/ckeditor5-table/tests/commands/setheadercolumncommand.js

@@ -7,8 +7,9 @@ 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 SetHeaderColumnCommand from '../../src/commands/setheadercolumncommand';
 import SetHeaderColumnCommand from '../../src/commands/setheadercolumncommand';
-import { defaultConversion, defaultSchema, formatTable, formattedModelTable, modelTable } from '../_utils/utils';
+import { defaultConversion, defaultSchema, modelTable } from '../_utils/utils';
 import TableUtils from '../../src/tableutils';
 import TableUtils from '../../src/tableutils';
+import { assertEqualMarkup } from '@ckeditor/ckeditor5-utils/tests/_utils/utils';
 
 
 describe( 'SetHeaderColumnCommand', () => {
 describe( 'SetHeaderColumnCommand', () => {
 	let editor, model, command;
 	let editor, model, command;
@@ -81,7 +82,7 @@ describe( 'SetHeaderColumnCommand', () => {
 
 
 			command.execute();
 			command.execute();
 
 
-			expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+			assertEqualMarkup( getData( model ), modelTable( [
 				[ '00', '01[]', '02', '03' ]
 				[ '00', '01[]', '02', '03' ]
 			], { headingColumns: 2 } ) );
 			], { headingColumns: 2 } ) );
 		} );
 		} );
@@ -93,7 +94,7 @@ describe( 'SetHeaderColumnCommand', () => {
 
 
 			command.execute();
 			command.execute();
 
 
-			expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+			assertEqualMarkup( getData( model ), modelTable( [
 				[ '00', '01[]', '02', '03' ]
 				[ '00', '01[]', '02', '03' ]
 			], { headingColumns: 1 } ) );
 			], { headingColumns: 1 } ) );
 		} );
 		} );
@@ -105,13 +106,13 @@ describe( 'SetHeaderColumnCommand', () => {
 
 
 			command.execute();
 			command.execute();
 
 
-			expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+			assertEqualMarkup( getData( model ), modelTable( [
 				[ '00', '01[]', '02', '03' ]
 				[ '00', '01[]', '02', '03' ]
 			], { headingColumns: 1 } ) );
 			], { headingColumns: 1 } ) );
 
 
 			command.execute();
 			command.execute();
 
 
-			expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+			assertEqualMarkup( getData( model ), modelTable( [
 				[ '00', '01[]', '02', '03' ]
 				[ '00', '01[]', '02', '03' ]
 			], { headingColumns: 2 } ) );
 			], { headingColumns: 2 } ) );
 		} );
 		} );
@@ -123,7 +124,7 @@ describe( 'SetHeaderColumnCommand', () => {
 
 
 			command.execute( { forceValue: true } );
 			command.execute( { forceValue: true } );
 
 
-			expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+			assertEqualMarkup( getData( model ), modelTable( [
 				[ '00', '01[]', '02', '03' ]
 				[ '00', '01[]', '02', '03' ]
 			], { headingColumns: 3 } ) );
 			], { headingColumns: 3 } ) );
 		} );
 		} );
@@ -135,7 +136,7 @@ describe( 'SetHeaderColumnCommand', () => {
 
 
 			command.execute( { forceValue: false } );
 			command.execute( { forceValue: false } );
 
 
-			expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+			assertEqualMarkup( getData( model ), modelTable( [
 				[ '00', '01[]', '02', '03' ]
 				[ '00', '01[]', '02', '03' ]
 			], { headingColumns: 1 } ) );
 			], { headingColumns: 1 } ) );
 		} );
 		} );

+ 13 - 12
packages/ckeditor5-table/tests/commands/setheaderrowcommand.js

@@ -6,8 +6,9 @@
 import ModelTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/modeltesteditor';
 import ModelTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/modeltesteditor';
 import { getData, setData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model';
 import { getData, setData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model';
 import SetHeaderRowCommand from '../../src/commands/setheaderrowcommand';
 import SetHeaderRowCommand from '../../src/commands/setheaderrowcommand';
-import { defaultConversion, defaultSchema, formatTable, formattedModelTable, modelTable } from '../_utils/utils';
+import { defaultConversion, defaultSchema, modelTable } from '../_utils/utils';
 import TableUtils from '../../src/tableutils';
 import TableUtils from '../../src/tableutils';
+import { assertEqualMarkup } from '@ckeditor/ckeditor5-utils/tests/_utils/utils';
 
 
 describe( 'SetHeaderRowCommand', () => {
 describe( 'SetHeaderRowCommand', () => {
 	let editor, model, command;
 	let editor, model, command;
@@ -92,7 +93,7 @@ describe( 'SetHeaderRowCommand', () => {
 
 
 			command.execute();
 			command.execute();
 
 
-			expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+			assertEqualMarkup( getData( model ), modelTable( [
 				[ '00' ],
 				[ '00' ],
 				[ '[]10' ],
 				[ '[]10' ],
 				[ '20' ],
 				[ '20' ],
@@ -110,7 +111,7 @@ describe( 'SetHeaderRowCommand', () => {
 
 
 			command.execute();
 			command.execute();
 
 
-			expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+			assertEqualMarkup( getData( model ), modelTable( [
 				[ '00' ],
 				[ '00' ],
 				[ '[]10' ],
 				[ '[]10' ],
 				[ '20' ],
 				[ '20' ],
@@ -137,7 +138,7 @@ describe( 'SetHeaderRowCommand', () => {
 
 
 			command.execute();
 			command.execute();
 
 
-			expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+			assertEqualMarkup( getData( model ), modelTable( [
 				[ '00' ],
 				[ '00' ],
 				[ '[]10' ],
 				[ '[]10' ],
 				[ '20' ],
 				[ '20' ],
@@ -155,7 +156,7 @@ describe( 'SetHeaderRowCommand', () => {
 
 
 			command.execute();
 			command.execute();
 
 
-			expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+			assertEqualMarkup( getData( model ), modelTable( [
 				[ '[]00' ],
 				[ '[]00' ],
 				[ '10' ],
 				[ '10' ],
 				[ '20' ],
 				[ '20' ],
@@ -173,7 +174,7 @@ describe( 'SetHeaderRowCommand', () => {
 
 
 			command.execute( { forceValue: true } );
 			command.execute( { forceValue: true } );
 
 
-			expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+			assertEqualMarkup( getData( model ), modelTable( [
 				[ '00' ],
 				[ '00' ],
 				[ '[]10' ],
 				[ '[]10' ],
 				[ '20' ],
 				[ '20' ],
@@ -191,7 +192,7 @@ describe( 'SetHeaderRowCommand', () => {
 
 
 			command.execute( { forceValue: false } );
 			command.execute( { forceValue: false } );
 
 
-			expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+			assertEqualMarkup( getData( model ), modelTable( [
 				[ '00' ],
 				[ '00' ],
 				[ '[]10' ],
 				[ '[]10' ],
 				[ '20' ],
 				[ '20' ],
@@ -208,7 +209,7 @@ describe( 'SetHeaderRowCommand', () => {
 
 
 			command.execute();
 			command.execute();
 
 
-			expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+			assertEqualMarkup( getData( model ), modelTable( [
 				[ '00', '01', '02' ],
 				[ '00', '01', '02' ],
 				[ { colspan: 2, contents: '10[]' }, '12' ],
 				[ { colspan: 2, contents: '10[]' }, '12' ],
 				[ { colspan: 2, contents: '' }, '22' ]
 				[ { colspan: 2, contents: '' }, '22' ]
@@ -227,7 +228,7 @@ describe( 'SetHeaderRowCommand', () => {
 
 
 			command.execute();
 			command.execute();
 
 
-			expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+			assertEqualMarkup( getData( model ), modelTable( [
 				[ '00', '01', '02' ],
 				[ '00', '01', '02' ],
 				[ { colspan: 2, rowspan: 2, contents: '10' }, '12' ],
 				[ { colspan: 2, rowspan: 2, contents: '10' }, '12' ],
 				[ '22[]' ],
 				[ '22[]' ],
@@ -245,7 +246,7 @@ describe( 'SetHeaderRowCommand', () => {
 
 
 			command.execute();
 			command.execute();
 
 
-			expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+			assertEqualMarkup( getData( model ), modelTable( [
 				[ '00', '01' ],
 				[ '00', '01' ],
 				[ '', '[]11' ]
 				[ '', '[]11' ]
 			], { headingRows: 1 } ) );
 			], { headingRows: 1 } ) );
@@ -259,7 +260,7 @@ describe( 'SetHeaderRowCommand', () => {
 
 
 			command.execute();
 			command.execute();
 
 
-			expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+			assertEqualMarkup( getData( model ), modelTable( [
 				[ '00', '01' ],
 				[ '00', '01' ],
 				[ '[]10', '' ]
 				[ '[]10', '' ]
 			], { headingRows: 1 } ) );
 			], { headingRows: 1 } ) );
@@ -274,7 +275,7 @@ describe( 'SetHeaderRowCommand', () => {
 
 
 			command.execute();
 			command.execute();
 
 
-			expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+			assertEqualMarkup( getData( model ), modelTable( [
 				[ '00', '[]01', '02' ],
 				[ '00', '[]01', '02' ],
 				[ { colspan: 2, rowspan: 2, contents: '10' }, '12' ],
 				[ { colspan: 2, rowspan: 2, contents: '10' }, '12' ],
 				[ '22' ]
 				[ '22' ]

+ 8 - 7
packages/ckeditor5-table/tests/commands/splitcellcommand.js

@@ -7,8 +7,9 @@ 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 SplitCellCommand from '../../src/commands/splitcellcommand';
 import SplitCellCommand from '../../src/commands/splitcellcommand';
-import { defaultConversion, defaultSchema, formatTable, formattedModelTable, modelTable } from '../_utils/utils';
+import { defaultConversion, defaultSchema, modelTable } from '../_utils/utils';
 import TableUtils from '../../src/tableutils';
 import TableUtils from '../../src/tableutils';
+import { assertEqualMarkup } from '@ckeditor/ckeditor5-utils/tests/_utils/utils';
 
 
 describe( 'SplitCellCommand', () => {
 describe( 'SplitCellCommand', () => {
 	let editor, model, command;
 	let editor, model, command;
@@ -64,7 +65,7 @@ describe( 'SplitCellCommand', () => {
 
 
 				command.execute();
 				command.execute();
 
 
-				expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+				assertEqualMarkup( getData( model ), modelTable( [
 					[ '00', { colspan: 2, contents: '01' }, '02' ],
 					[ '00', { colspan: 2, contents: '01' }, '02' ],
 					[ '10', '[]11', '', '12' ],
 					[ '10', '[]11', '', '12' ],
 					[ '20', { colspan: 3, contents: '21' } ],
 					[ '20', { colspan: 3, contents: '21' } ],
@@ -82,7 +83,7 @@ describe( 'SplitCellCommand', () => {
 
 
 				command.execute();
 				command.execute();
 
 
-				expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+				assertEqualMarkup( getData( model ), modelTable( [
 					[ '00', '01', '02' ],
 					[ '00', '01', '02' ],
 					[ '10', '11', '12' ],
 					[ '10', '11', '12' ],
 					[ '20', '21[]', '' ],
 					[ '20', '21[]', '' ],
@@ -98,7 +99,7 @@ describe( 'SplitCellCommand', () => {
 
 
 				command.execute();
 				command.execute();
 
 
-				expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+				assertEqualMarkup( getData( model ), modelTable( [
 					[ '00', '01', '02' ],
 					[ '00', '01', '02' ],
 					[ { colspan: 2, contents: '10[]' }, '' ]
 					[ { colspan: 2, contents: '10[]' }, '' ]
 				] ) );
 				] ) );
@@ -112,7 +113,7 @@ describe( 'SplitCellCommand', () => {
 
 
 				command.execute();
 				command.execute();
 
 
-				expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+				assertEqualMarkup( getData( model ), modelTable( [
 					[ '00', '01', '02', '03' ],
 					[ '00', '01', '02', '03' ],
 					[ { colspan: 2, contents: '10[]' }, { colspan: 2, contents: '' } ]
 					[ { colspan: 2, contents: '10[]' }, { colspan: 2, contents: '' } ]
 				] ) );
 				] ) );
@@ -127,7 +128,7 @@ describe( 'SplitCellCommand', () => {
 
 
 				command.execute();
 				command.execute();
 
 
-				expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+				assertEqualMarkup( getData( model ), modelTable( [
 					[ '00', '01', '02', '03', '04', '05' ],
 					[ '00', '01', '02', '03', '04', '05' ],
 					[ { colspan: 3, rowspan: 2, contents: '10[]' }, { colspan: 2, rowspan: 2, contents: '' }, '15' ],
 					[ { colspan: 3, rowspan: 2, contents: '10[]' }, { colspan: 2, rowspan: 2, contents: '' }, '15' ],
 					[ '25' ]
 					[ '25' ]
@@ -167,7 +168,7 @@ describe( 'SplitCellCommand', () => {
 
 
 				command.execute();
 				command.execute();
 
 
-				expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+				assertEqualMarkup( getData( model ), modelTable( [
 					[ '00', '01', '02' ],
 					[ '00', '01', '02' ],
 					[ { rowspan: 2, contents: '10' }, '[]11', { rowspan: 2, contents: '12' } ],
 					[ { rowspan: 2, contents: '10' }, '[]11', { rowspan: 2, contents: '12' } ],
 					[ '' ],
 					[ '' ],

+ 77 - 77
packages/ckeditor5-table/tests/converters/downcast.js

@@ -7,9 +7,10 @@ import VirtualTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/virtualtest
 import { getData as getViewData } from '@ckeditor/ckeditor5-engine/src/dev-utils/view';
 import { getData as getViewData } from '@ckeditor/ckeditor5-engine/src/dev-utils/view';
 import { setData as setModelData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model';
 import { setData as setModelData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model';
 
 
-import { defaultConversion, defaultSchema, formatTable, formattedViewTable, modelTable } from '../_utils/utils';
+import { defaultConversion, defaultSchema, modelTable, viewTable } from '../_utils/utils';
 import env from '@ckeditor/ckeditor5-utils/src/env';
 import env from '@ckeditor/ckeditor5-utils/src/env';
 import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';
 import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';
+import { assertEqualMarkup } from '@ckeditor/ckeditor5-utils/tests/_utils/utils';
 
 
 function paragraphInTableCell() {
 function paragraphInTableCell() {
 	return dispatcher => dispatcher.on( 'insert:paragraph', ( evt, data, conversionApi ) => {
 	return dispatcher => dispatcher.on( 'insert:paragraph', ( evt, data, conversionApi ) => {
@@ -59,7 +60,7 @@ describe( 'downcast converters', () => {
 		it( 'should create table with tbody', () => {
 		it( 'should create table with tbody', () => {
 			setModelData( model, modelTable( [ [ '' ] ] ) );
 			setModelData( model, modelTable( [ [ '' ] ] ) );
 
 
-			expect( formatTable( getViewData( viewDocument, { withoutSelection: true } ) ) ).to.equal( formatTable(
+			assertEqualMarkup( getViewData( viewDocument, { withoutSelection: true } ),
 				'<figure class="table">' +
 				'<figure class="table">' +
 					'<table>' +
 					'<table>' +
 						'<tbody>' +
 						'<tbody>' +
@@ -67,7 +68,7 @@ describe( 'downcast converters', () => {
 						'</tbody>' +
 						'</tbody>' +
 					'</table>' +
 					'</table>' +
 				'</figure>'
 				'</figure>'
-			) );
+			);
 		} );
 		} );
 
 
 		it( 'should create table with tbody and thead', () => {
 		it( 'should create table with tbody and thead', () => {
@@ -76,7 +77,7 @@ describe( 'downcast converters', () => {
 				[ '10' ]
 				[ '10' ]
 			], { headingRows: 1 } ) );
 			], { headingRows: 1 } ) );
 
 
-			expect( formatTable( getViewData( viewDocument, { withoutSelection: true } ) ) ).to.equal( formatTable(
+			assertEqualMarkup( getViewData( viewDocument, { withoutSelection: true } ),
 				'<figure class="table">' +
 				'<figure class="table">' +
 					'<table>' +
 					'<table>' +
 						'<thead>' +
 						'<thead>' +
@@ -87,7 +88,7 @@ describe( 'downcast converters', () => {
 						'</tbody>' +
 						'</tbody>' +
 					'</table>' +
 					'</table>' +
 				'</figure>'
 				'</figure>'
-			) );
+			);
 		} );
 		} );
 
 
 		it( 'should create table with thead', () => {
 		it( 'should create table with thead', () => {
@@ -96,7 +97,7 @@ describe( 'downcast converters', () => {
 				[ '10' ]
 				[ '10' ]
 			], { headingRows: 2 } ) );
 			], { headingRows: 2 } ) );
 
 
-			expect( formatTable( getViewData( viewDocument, { withoutSelection: true } ) ) ).to.equal( formatTable(
+			assertEqualMarkup( getViewData( viewDocument, { withoutSelection: true } ),
 				'<figure class="table">' +
 				'<figure class="table">' +
 					'<table>' +
 					'<table>' +
 						'<thead>' +
 						'<thead>' +
@@ -105,7 +106,7 @@ describe( 'downcast converters', () => {
 						'</thead>' +
 						'</thead>' +
 					'</table>' +
 					'</table>' +
 				'</figure>'
 				'</figure>'
-			) );
+			);
 		} );
 		} );
 
 
 		it( 'should create table with heading columns and rows', () => {
 		it( 'should create table with heading columns and rows', () => {
@@ -114,7 +115,7 @@ describe( 'downcast converters', () => {
 				[ '10', '11', '12', '13' ]
 				[ '10', '11', '12', '13' ]
 			], { headingColumns: 3, headingRows: 1 } ) );
 			], { headingColumns: 3, headingRows: 1 } ) );
 
 
-			expect( formatTable( getViewData( viewDocument, { withoutSelection: true } ) ) ).to.equal( formatTable(
+			assertEqualMarkup( getViewData( viewDocument, { withoutSelection: true } ),
 				'<figure class="table">' +
 				'<figure class="table">' +
 					'<table>' +
 					'<table>' +
 						'<thead>' +
 						'<thead>' +
@@ -125,7 +126,7 @@ describe( 'downcast converters', () => {
 						'</tbody>' +
 						'</tbody>' +
 					'</table>' +
 					'</table>' +
 				'</figure>'
 				'</figure>'
-			) );
+			);
 		} );
 		} );
 
 
 		it( 'should create table with block content', () => {
 		it( 'should create table with block content', () => {
@@ -133,7 +134,7 @@ describe( 'downcast converters', () => {
 				[ '<paragraph>00</paragraph><paragraph>foo</paragraph>', '01' ]
 				[ '<paragraph>00</paragraph><paragraph>foo</paragraph>', '01' ]
 			] ) );
 			] ) );
 
 
-			expect( formatTable( getViewData( viewDocument, { withoutSelection: true } ) ) ).to.equal( formatTable(
+			assertEqualMarkup( getViewData( viewDocument, { withoutSelection: true } ),
 				'<figure class="table">' +
 				'<figure class="table">' +
 					'<table>' +
 					'<table>' +
 						'<tbody>' +
 						'<tbody>' +
@@ -144,7 +145,7 @@ describe( 'downcast converters', () => {
 						'</tbody>' +
 						'</tbody>' +
 					'</table>' +
 					'</table>' +
 				'</figure>'
 				'</figure>'
-			) );
+			);
 		} );
 		} );
 
 
 		it( 'should create table with block content (attribute on paragraph)', () => {
 		it( 'should create table with block content (attribute on paragraph)', () => {
@@ -163,7 +164,7 @@ describe( 'downcast converters', () => {
 				[ '<paragraph alignment="right">00</paragraph>' ]
 				[ '<paragraph alignment="right">00</paragraph>' ]
 			] ) );
 			] ) );
 
 
-			expect( formatTable( getViewData( viewDocument, { withoutSelection: true } ) ) ).to.equal( formatTable(
+			assertEqualMarkup( getViewData( viewDocument, { withoutSelection: true } ),
 				'<figure class="table">' +
 				'<figure class="table">' +
 					'<table>' +
 					'<table>' +
 						'<tbody>' +
 						'<tbody>' +
@@ -173,7 +174,7 @@ describe( 'downcast converters', () => {
 						'</tbody>' +
 						'</tbody>' +
 					'</table>' +
 					'</table>' +
 				'</figure>'
 				'</figure>'
-			) );
+			);
 		} );
 		} );
 
 
 		it( 'should be possible to overwrite', () => {
 		it( 'should be possible to overwrite', () => {
@@ -193,11 +194,11 @@ describe( 'downcast converters', () => {
 
 
 			setModelData( model, modelTable( [ [ '' ] ] ) );
 			setModelData( model, modelTable( [ [ '' ] ] ) );
 
 
-			expect( formatTable( getViewData( viewDocument, { withoutSelection: true } ) ) ).to.equal( formatTable(
+			assertEqualMarkup( getViewData( viewDocument, { withoutSelection: true } ),
 				'<table foo="bar">' +
 				'<table foo="bar">' +
 					'<tr><td><p></p></td></tr>' +
 					'<tr><td><p></p></td></tr>' +
 				'</table>'
 				'</table>'
-			) );
+			);
 		} );
 		} );
 
 
 		it( 'should re-create table on reinsert', () => {
 		it( 'should re-create table on reinsert', () => {
@@ -209,7 +210,7 @@ describe( 'downcast converters', () => {
 
 
 			setModelData( model, modelTable( [ [ '[]' ] ] ) );
 			setModelData( model, modelTable( [ [ '[]' ] ] ) );
 
 
-			expect( formatTable( getViewData( viewDocument, { withoutSelection: true } ) ) ).to.equal( formatTable(
+			assertEqualMarkup( getViewData( viewDocument, { withoutSelection: true } ),
 				'<figure class="table">' +
 				'<figure class="table">' +
 					'<table>' +
 					'<table>' +
 						'<tbody>' +
 						'<tbody>' +
@@ -217,7 +218,7 @@ describe( 'downcast converters', () => {
 						'</tbody>' +
 						'</tbody>' +
 					'</table>' +
 					'</table>' +
 				'</figure>'
 				'</figure>'
-			) );
+			);
 
 
 			model.change( writer => {
 			model.change( writer => {
 				const table = model.document.getRoot().getChild( 0 );
 				const table = model.document.getRoot().getChild( 0 );
@@ -227,7 +228,7 @@ describe( 'downcast converters', () => {
 				writer.wrap( range, wrapper );
 				writer.wrap( range, wrapper );
 			} );
 			} );
 
 
-			expect( formatTable( getViewData( viewDocument, { withoutSelection: true } ) ) ).to.equal( formatTable(
+			assertEqualMarkup( getViewData( viewDocument, { withoutSelection: true } ),
 				'<div>' +
 				'<div>' +
 					'<figure class="table">' +
 					'<figure class="table">' +
 						'<table>' +
 						'<table>' +
@@ -237,7 +238,7 @@ describe( 'downcast converters', () => {
 						'</table>' +
 						'</table>' +
 					'</figure>' +
 					'</figure>' +
 				'</div>'
 				'</div>'
-			) );
+			);
 		} );
 		} );
 
 
 		describe( 'headingColumns attribute', () => {
 		describe( 'headingColumns attribute', () => {
@@ -247,7 +248,7 @@ describe( 'downcast converters', () => {
 					[ '10', '11', '12' ]
 					[ '10', '11', '12' ]
 				], { headingColumns: 2 } ) );
 				], { headingColumns: 2 } ) );
 
 
-				expect( formatTable( getViewData( viewDocument, { withoutSelection: true } ) ) ).to.equal( formatTable(
+				assertEqualMarkup( getViewData( viewDocument, { withoutSelection: true } ),
 					'<figure class="table">' +
 					'<figure class="table">' +
 						'<table>' +
 						'<table>' +
 							'<tbody>' +
 							'<tbody>' +
@@ -256,7 +257,7 @@ describe( 'downcast converters', () => {
 							'</tbody>' +
 							'</tbody>' +
 						'</table>' +
 						'</table>' +
 					'</figure>'
 					'</figure>'
-				) );
+				);
 			} );
 			} );
 
 
 			it( 'should mark heading columns table cells when one has colspan attribute', () => {
 			it( 'should mark heading columns table cells when one has colspan attribute', () => {
@@ -265,7 +266,7 @@ describe( 'downcast converters', () => {
 					[ { colspan: 2, contents: '10' }, '12', '13' ]
 					[ { colspan: 2, contents: '10' }, '12', '13' ]
 				], { headingColumns: 3 } ) );
 				], { headingColumns: 3 } ) );
 
 
-				expect( formatTable( getViewData( viewDocument, { withoutSelection: true } ) ) ).to.equal( formatTable(
+				assertEqualMarkup( getViewData( viewDocument, { withoutSelection: true } ),
 					'<figure class="table">' +
 					'<figure class="table">' +
 						'<table>' +
 						'<table>' +
 							'<tbody>' +
 							'<tbody>' +
@@ -274,7 +275,7 @@ describe( 'downcast converters', () => {
 							'</tbody>' +
 							'</tbody>' +
 						'</table>' +
 						'</table>' +
 					'</figure>'
 					'</figure>'
-				) );
+				);
 			} );
 			} );
 
 
 			it( 'should work with colspan and rowspan attributes on table cells', () => {
 			it( 'should work with colspan and rowspan attributes on table cells', () => {
@@ -299,7 +300,7 @@ describe( 'downcast converters', () => {
 					[ '32', '33' ]
 					[ '32', '33' ]
 				], { headingColumns: 3 } ) );
 				], { headingColumns: 3 } ) );
 
 
-				expect( formatTable( getViewData( viewDocument, { withoutSelection: true } ) ) ).to.equal( formatTable(
+				assertEqualMarkup( getViewData( viewDocument, { withoutSelection: true } ),
 					'<figure class="table">' +
 					'<figure class="table">' +
 						'<table>' +
 						'<table>' +
 							'<tbody>' +
 							'<tbody>' +
@@ -310,7 +311,7 @@ describe( 'downcast converters', () => {
 							'</tbody>' +
 							'</tbody>' +
 						'</table>' +
 						'</table>' +
 					'</figure>'
 					'</figure>'
-				) );
+				);
 			} );
 			} );
 		} );
 		} );
 
 
@@ -332,7 +333,7 @@ describe( 'downcast converters', () => {
 			it( 'should create table as a widget', () => {
 			it( 'should create table as a widget', () => {
 				setModelData( model, modelTable( [ [ '' ] ] ) );
 				setModelData( model, modelTable( [ [ '' ] ] ) );
 
 
-				expect( formatTable( getViewData( viewDocument, { withoutSelection: true } ) ) ).to.equal( formatTable(
+				assertEqualMarkup( getViewData( viewDocument, { withoutSelection: true } ),
 					'<figure class="ck-widget ck-widget_with-selection-handle table" contenteditable="false">' +
 					'<figure class="ck-widget ck-widget_with-selection-handle table" contenteditable="false">' +
 					'<div class="ck ck-widget__selection-handle"></div>' +
 					'<div class="ck ck-widget__selection-handle"></div>' +
 						'<table>' +
 						'<table>' +
@@ -343,7 +344,7 @@ describe( 'downcast converters', () => {
 							'</tbody>' +
 							'</tbody>' +
 						'</table>' +
 						'</table>' +
 					'</figure>'
 					'</figure>'
-				) );
+				);
 			} );
 			} );
 		} );
 		} );
 	} );
 	} );
@@ -365,7 +366,7 @@ describe( 'downcast converters', () => {
 				writer.insertElement( 'tableCell', row, 'end' );
 				writer.insertElement( 'tableCell', row, 'end' );
 			} );
 			} );
 
 
-			expect( formatTable( getViewData( viewDocument, { withoutSelection: true } ) ) ).to.equal( formattedViewTable( [
+			assertEqualMarkup( getViewData( viewDocument, { withoutSelection: true } ), viewTable( [
 				[ '00', '01' ],
 				[ '00', '01' ],
 				[ '', '' ]
 				[ '', '' ]
 			] ) );
 			] ) );
@@ -387,7 +388,7 @@ describe( 'downcast converters', () => {
 				writer.insertElement( 'tableCell', row, 'end' );
 				writer.insertElement( 'tableCell', row, 'end' );
 			} );
 			} );
 
 
-			expect( formatTable( getViewData( viewDocument, { withoutSelection: true } ) ) ).to.equal( formattedViewTable( [
+			assertEqualMarkup( getViewData( viewDocument, { withoutSelection: true } ), viewTable( [
 				[ '00', '01' ],
 				[ '00', '01' ],
 				[ '', '' ]
 				[ '', '' ]
 			] ) );
 			] ) );
@@ -401,7 +402,7 @@ describe( 'downcast converters', () => {
 				writer.insertElement( 'tableCell', row, 'end' );
 				writer.insertElement( 'tableCell', row, 'end' );
 			} );
 			} );
 
 
-			expect( formatTable( getViewData( viewDocument, { withoutSelection: true } ) ) ).to.equal( formattedViewTable( [
+			assertEqualMarkup( getViewData( viewDocument, { withoutSelection: true } ), viewTable( [
 				[ '00', '01' ],
 				[ '00', '01' ],
 				[ '', '' ],
 				[ '', '' ],
 				[ '', '' ]
 				[ '', '' ]
@@ -426,7 +427,7 @@ describe( 'downcast converters', () => {
 				writer.insertElement( 'tableCell', row, 'end' );
 				writer.insertElement( 'tableCell', row, 'end' );
 			} );
 			} );
 
 
-			expect( formatTable( getViewData( viewDocument, { withoutSelection: true } ) ) ).to.equal( formattedViewTable( [
+			assertEqualMarkup( getViewData( viewDocument, { withoutSelection: true } ), viewTable( [
 				[ '00', '01' ],
 				[ '00', '01' ],
 				[ '', '' ],
 				[ '', '' ],
 				[ '21', '22' ],
 				[ '21', '22' ],
@@ -452,7 +453,7 @@ describe( 'downcast converters', () => {
 				writer.insertElement( 'tableCell', row, 'end' );
 				writer.insertElement( 'tableCell', row, 'end' );
 			} );
 			} );
 
 
-			expect( formatTable( getViewData( viewDocument, { withoutSelection: true } ) ) ).to.equal( formattedViewTable( [
+			assertEqualMarkup( getViewData( viewDocument, { withoutSelection: true } ), viewTable( [
 				[ '00', '01' ],
 				[ '00', '01' ],
 				[ '', '' ],
 				[ '', '' ],
 				[ '21', '22' ],
 				[ '21', '22' ],
@@ -478,7 +479,7 @@ describe( 'downcast converters', () => {
 				writer.insertElement( 'tableCell', row, 'end' );
 				writer.insertElement( 'tableCell', row, 'end' );
 			} );
 			} );
 
 
-			expect( formatTable( getViewData( viewDocument, { withoutSelection: true } ) ) ).to.equal( formattedViewTable( [
+			assertEqualMarkup( getViewData( viewDocument, { withoutSelection: true } ), viewTable( [
 				[ '00', '01' ],
 				[ '00', '01' ],
 				[ '', '' ],
 				[ '', '' ],
 				[ '21', '22' ],
 				[ '21', '22' ],
@@ -501,7 +502,7 @@ describe( 'downcast converters', () => {
 				writer.insertElement( 'tableCell', row, 'end' );
 				writer.insertElement( 'tableCell', row, 'end' );
 			} );
 			} );
 
 
-			expect( formatTable( getViewData( viewDocument, { withoutSelection: true } ) ) ).to.equal( formattedViewTable( [
+			assertEqualMarkup( getViewData( viewDocument, { withoutSelection: true } ), viewTable( [
 				[ { rowspan: 3, contents: '00' }, '01' ],
 				[ { rowspan: 3, contents: '00' }, '01' ],
 				[ '22' ],
 				[ '22' ],
 				[ '' ]
 				[ '' ]
@@ -529,7 +530,7 @@ describe( 'downcast converters', () => {
 				writer.insert( writer.createElement( 'tableCell' ), secondRow, 'end' );
 				writer.insert( writer.createElement( 'tableCell' ), secondRow, 'end' );
 			} );
 			} );
 
 
-			expect( formatTable( getViewData( viewDocument, { withoutSelection: true } ) ) ).to.equal( formattedViewTable( [
+			assertEqualMarkup( getViewData( viewDocument, { withoutSelection: true } ), viewTable( [
 				[ { rowspan: 3, contents: '00', isHeading: true }, '01' ],
 				[ { rowspan: 3, contents: '00', isHeading: true }, '01' ],
 				[ '22' ],
 				[ '22' ],
 				[ '' ],
 				[ '' ],
@@ -564,8 +565,7 @@ describe( 'downcast converters', () => {
 					writer.insert( writer.createElement( 'tableCell' ), firstRow, 'end' );
 					writer.insert( writer.createElement( 'tableCell' ), firstRow, 'end' );
 				} );
 				} );
 
 
-				expect( formatTable(
-					getViewData( viewDocument, { withoutSelection: true } ) ) ).to.equal( formatTable(
+				assertEqualMarkup( getViewData( viewDocument, { withoutSelection: true } ),
 					'<figure class="ck-widget ck-widget_with-selection-handle table" contenteditable="false">' +
 					'<figure class="ck-widget ck-widget_with-selection-handle table" contenteditable="false">' +
 						'<div class="ck ck-widget__selection-handle"></div>' +
 						'<div class="ck ck-widget__selection-handle"></div>' +
 						'<table>' +
 						'<table>' +
@@ -581,7 +581,7 @@ describe( 'downcast converters', () => {
 							'</tbody>' +
 							'</tbody>' +
 						'</table>' +
 						'</table>' +
 					'</figure>'
 					'</figure>'
-				) );
+				);
 			} );
 			} );
 		} );
 		} );
 	} );
 	} );
@@ -600,7 +600,7 @@ describe( 'downcast converters', () => {
 				writer.insertElement( 'tableCell', row, 1 );
 				writer.insertElement( 'tableCell', row, 1 );
 			} );
 			} );
 
 
-			expect( formatTable( getViewData( viewDocument, { withoutSelection: true } ) ) ).to.equal( formattedViewTable( [
+			assertEqualMarkup( getViewData( viewDocument, { withoutSelection: true } ), viewTable( [
 				[ '00', '', '01' ]
 				[ '00', '', '01' ]
 			] ) );
 			] ) );
 		} );
 		} );
@@ -618,7 +618,7 @@ describe( 'downcast converters', () => {
 				writer.insertElement( 'tableCell', row, 1 );
 				writer.insertElement( 'tableCell', row, 1 );
 			} );
 			} );
 
 
-			expect( formatTable( getViewData( viewDocument, { withoutSelection: true } ) ) ).to.equal( formattedViewTable( [
+			assertEqualMarkup( getViewData( viewDocument, { withoutSelection: true } ), viewTable( [
 				[ { colspan: 2, contents: '00' }, '', '13' ]
 				[ { colspan: 2, contents: '00' }, '', '13' ]
 			] ) );
 			] ) );
 		} );
 		} );
@@ -636,7 +636,7 @@ describe( 'downcast converters', () => {
 				writer.insertElement( 'tableCell', table.getChild( 1 ), 0 );
 				writer.insertElement( 'tableCell', table.getChild( 1 ), 0 );
 			} );
 			} );
 
 
-			expect( formatTable( getViewData( viewDocument, { withoutSelection: true } ) ) ).to.equal( formattedViewTable( [
+			assertEqualMarkup( getViewData( viewDocument, { withoutSelection: true } ), viewTable( [
 				[ { rowspan: 2, contents: '00' }, '', '13' ],
 				[ { rowspan: 2, contents: '00' }, '', '13' ],
 				[ '', '11', '12' ]
 				[ '', '11', '12' ]
 			] ) );
 			] ) );
@@ -658,7 +658,7 @@ describe( 'downcast converters', () => {
 				writer.setAttribute( 'colspan', 2, secondRow.getChild( 0 ) );
 				writer.setAttribute( 'colspan', 2, secondRow.getChild( 0 ) );
 			} );
 			} );
 
 
-			expect( formatTable( getViewData( viewDocument, { withoutSelection: true } ) ) ).to.equal( formattedViewTable( [
+			assertEqualMarkup( getViewData( viewDocument, { withoutSelection: true } ), viewTable( [
 				[ '00', '', '01' ],
 				[ '00', '', '01' ],
 				[ { colspan: 2, contents: '10' }, '11' ]
 				[ { colspan: 2, contents: '10' }, '11' ]
 			] ) );
 			] ) );
@@ -679,7 +679,7 @@ describe( 'downcast converters', () => {
 				writer.remove( firstRow.getChild( 1 ) );
 				writer.remove( firstRow.getChild( 1 ) );
 			} );
 			} );
 
 
-			expect( formatTable( getViewData( viewDocument, { withoutSelection: true } ) ) ).to.equal( formattedViewTable( [
+			assertEqualMarkup( getViewData( viewDocument, { withoutSelection: true } ), viewTable( [
 				[ { colspan: 2, contents: '00' } ],
 				[ { colspan: 2, contents: '00' } ],
 				[ '10', '11' ]
 				[ '10', '11' ]
 			] ) );
 			] ) );
@@ -711,21 +711,21 @@ describe( 'downcast converters', () => {
 					writer.insert( writer.createElement( 'tableCell' ), row, 'end' );
 					writer.insert( writer.createElement( 'tableCell' ), row, 'end' );
 				} );
 				} );
 
 
-				expect( formatTable( getViewData( viewDocument, { withoutSelection: true } ) ) ).to.equal( formatTable(
+				assertEqualMarkup( getViewData( viewDocument, { withoutSelection: true } ),
 					'<figure class="ck-widget ck-widget_with-selection-handle table" contenteditable="false">' +
 					'<figure class="ck-widget ck-widget_with-selection-handle table" contenteditable="false">' +
 					'<div class="ck ck-widget__selection-handle"></div>' +
 					'<div class="ck ck-widget__selection-handle"></div>' +
 						'<table>' +
 						'<table>' +
 							'<tbody>' +
 							'<tbody>' +
 								'<tr>' +
 								'<tr>' +
-					'<td class="ck-editor__editable ck-editor__nested-editable" contenteditable="true">' +
-					'<span>00</span>' +
-					'</td>' +
+									'<td class="ck-editor__editable ck-editor__nested-editable" contenteditable="true">' +
+										'<span>00</span>' +
+									'</td>' +
 									'<td class="ck-editor__editable ck-editor__nested-editable" contenteditable="true"></td>' +
 									'<td class="ck-editor__editable ck-editor__nested-editable" contenteditable="true"></td>' +
 								'</tr>' +
 								'</tr>' +
 							'</tbody>' +
 							'</tbody>' +
 						'</table>' +
 						'</table>' +
 					'</figure>'
 					'</figure>'
-				) );
+				);
 			} );
 			} );
 		} );
 		} );
 	} );
 	} );
@@ -743,7 +743,7 @@ describe( 'downcast converters', () => {
 				writer.setAttribute( 'headingColumns', 1, table );
 				writer.setAttribute( 'headingColumns', 1, table );
 			} );
 			} );
 
 
-			expect( formatTable( getViewData( viewDocument, { withoutSelection: true } ) ) ).to.equal( formattedViewTable( [
+			assertEqualMarkup( getViewData( viewDocument, { withoutSelection: true } ), viewTable( [
 				[ { isHeading: true, contents: '00' }, '01' ],
 				[ { isHeading: true, contents: '00' }, '01' ],
 				[ { isHeading: true, contents: '10' }, '11' ]
 				[ { isHeading: true, contents: '10' }, '11' ]
 			], { headingColumns: 1 } ) );
 			], { headingColumns: 1 } ) );
@@ -761,7 +761,7 @@ describe( 'downcast converters', () => {
 				writer.setAttribute( 'headingColumns', 3, table );
 				writer.setAttribute( 'headingColumns', 3, table );
 			} );
 			} );
 
 
-			expect( formatTable( getViewData( viewDocument, { withoutSelection: true } ) ) ).to.equal( formattedViewTable( [
+			assertEqualMarkup( getViewData( viewDocument, { withoutSelection: true } ), viewTable( [
 				[ { isHeading: true, contents: '00' }, { isHeading: true, contents: '01' }, { isHeading: true, contents: '02' }, '03' ],
 				[ { isHeading: true, contents: '00' }, { isHeading: true, contents: '01' }, { isHeading: true, contents: '02' }, '03' ],
 				[ { isHeading: true, contents: '10' }, { isHeading: true, contents: '11' }, { isHeading: true, contents: '12' }, '13' ]
 				[ { isHeading: true, contents: '10' }, { isHeading: true, contents: '11' }, { isHeading: true, contents: '12' }, '13' ]
 			] ) );
 			] ) );
@@ -779,7 +779,7 @@ describe( 'downcast converters', () => {
 				writer.setAttribute( 'headingColumns', 1, table );
 				writer.setAttribute( 'headingColumns', 1, table );
 			} );
 			} );
 
 
-			expect( formatTable( getViewData( viewDocument, { withoutSelection: true } ) ) ).to.equal( formattedViewTable( [
+			assertEqualMarkup( getViewData( viewDocument, { withoutSelection: true } ), viewTable( [
 				[ { isHeading: true, contents: '00' }, '01', '02', '03' ],
 				[ { isHeading: true, contents: '00' }, '01', '02', '03' ],
 				[ { isHeading: true, contents: '10' }, '11', '12', '13' ]
 				[ { isHeading: true, contents: '10' }, '11', '12', '13' ]
 			], { headingColumns: 3 } ) );
 			], { headingColumns: 3 } ) );
@@ -796,7 +796,7 @@ describe( 'downcast converters', () => {
 				writer.removeAttribute( 'headingColumns', table );
 				writer.removeAttribute( 'headingColumns', table );
 			} );
 			} );
 
 
-			expect( formatTable( getViewData( viewDocument, { withoutSelection: true } ) ) ).to.equal( formattedViewTable( [
+			assertEqualMarkup( getViewData( viewDocument, { withoutSelection: true } ), viewTable( [
 				[ '00', '01' ],
 				[ '00', '01' ],
 				[ '10', '11' ]
 				[ '10', '11' ]
 			] ) );
 			] ) );
@@ -812,7 +812,7 @@ describe( 'downcast converters', () => {
 				writer.setAttribute( 'headingColumns', 1, table );
 				writer.setAttribute( 'headingColumns', 1, table );
 			} );
 			} );
 
 
-			expect( formatTable( getViewData( viewDocument, { withoutSelection: true } ) ) ).to.equal( formatTable(
+			assertEqualMarkup( getViewData( viewDocument, { withoutSelection: true } ),
 				'<figure class="table" headingColumns="1">' +
 				'<figure class="table" headingColumns="1">' +
 					'<table>' +
 					'<table>' +
 						'<tbody>' +
 						'<tbody>' +
@@ -820,7 +820,7 @@ describe( 'downcast converters', () => {
 						'</tbody>' +
 						'</tbody>' +
 					'</table>' +
 					'</table>' +
 				'</figure>'
 				'</figure>'
-			) );
+			);
 		} );
 		} );
 
 
 		it( 'should work with adding table cells', () => {
 		it( 'should work with adding table cells', () => {
@@ -841,7 +841,7 @@ describe( 'downcast converters', () => {
 				writer.insertElement( 'tableCell', table.getChild( 2 ), 1 );
 				writer.insertElement( 'tableCell', table.getChild( 2 ), 1 );
 			} );
 			} );
 
 
-			expect( formatTable( getViewData( viewDocument, { withoutSelection: true } ) ) ).to.equal( formattedViewTable( [
+			assertEqualMarkup( getViewData( viewDocument, { withoutSelection: true } ), viewTable( [
 				[
 				[
 					{ isHeading: true, rowspan: 2, contents: '00' },
 					{ isHeading: true, rowspan: 2, contents: '00' },
 					{ isHeading: true, contents: '01' },
 					{ isHeading: true, contents: '01' },
@@ -888,7 +888,7 @@ describe( 'downcast converters', () => {
 					writer.setAttribute( 'headingRows', 1, table );
 					writer.setAttribute( 'headingRows', 1, table );
 				} );
 				} );
 
 
-				expect( formatTable( getViewData( viewDocument, { withoutSelection: true } ) ) ).to.equal( formatTable(
+				assertEqualMarkup( getViewData( viewDocument, { withoutSelection: true } ),
 					'<figure class="ck-widget ck-widget_with-selection-handle table" contenteditable="false">' +
 					'<figure class="ck-widget ck-widget_with-selection-handle table" contenteditable="false">' +
 					'<div class="ck ck-widget__selection-handle"></div>' +
 					'<div class="ck ck-widget__selection-handle"></div>' +
 						'<table>' +
 						'<table>' +
@@ -901,7 +901,7 @@ describe( 'downcast converters', () => {
 							'</thead>' +
 							'</thead>' +
 						'</table>' +
 						'</table>' +
 					'</figure>'
 					'</figure>'
-				) );
+				);
 			} );
 			} );
 		} );
 		} );
 	} );
 	} );
@@ -920,7 +920,7 @@ describe( 'downcast converters', () => {
 				writer.setAttribute( 'headingRows', 2, table );
 				writer.setAttribute( 'headingRows', 2, table );
 			} );
 			} );
 
 
-			expect( formatTable( getViewData( viewDocument, { withoutSelection: true } ) ) ).to.equal( formattedViewTable( [
+			assertEqualMarkup( getViewData( viewDocument, { withoutSelection: true } ), viewTable( [
 				[ '00', '01' ],
 				[ '00', '01' ],
 				[ '10', '11' ],
 				[ '10', '11' ],
 				[ '20', '21' ]
 				[ '20', '21' ]
@@ -940,7 +940,7 @@ describe( 'downcast converters', () => {
 				writer.setAttribute( 'headingRows', 2, table );
 				writer.setAttribute( 'headingRows', 2, table );
 			} );
 			} );
 
 
-			expect( formatTable( getViewData( viewDocument, { withoutSelection: true } ) ) ).to.equal( formattedViewTable( [
+			assertEqualMarkup( getViewData( viewDocument, { withoutSelection: true } ), viewTable( [
 				[ '00', '01' ],
 				[ '00', '01' ],
 				[ '10', '11' ],
 				[ '10', '11' ],
 				[ '20', '21' ]
 				[ '20', '21' ]
@@ -961,7 +961,7 @@ describe( 'downcast converters', () => {
 				writer.setAttribute( 'headingRows', 2, table );
 				writer.setAttribute( 'headingRows', 2, table );
 			} );
 			} );
 
 
-			expect( formatTable( getViewData( viewDocument, { withoutSelection: true } ) ) ).to.equal( formattedViewTable( [
+			assertEqualMarkup( getViewData( viewDocument, { withoutSelection: true } ), viewTable( [
 				[ '00', '01' ],
 				[ '00', '01' ],
 				[ '10', '11' ],
 				[ '10', '11' ],
 				[ '20', '21' ],
 				[ '20', '21' ],
@@ -981,7 +981,7 @@ describe( 'downcast converters', () => {
 				writer.removeAttribute( 'headingRows', table );
 				writer.removeAttribute( 'headingRows', table );
 			} );
 			} );
 
 
-			expect( formatTable( getViewData( viewDocument, { withoutSelection: true } ) ) ).to.equal( formattedViewTable( [
+			assertEqualMarkup( getViewData( viewDocument, { withoutSelection: true } ), viewTable( [
 				[ '00', '01' ],
 				[ '00', '01' ],
 				[ '10', '11' ]
 				[ '10', '11' ]
 			] ) );
 			] ) );
@@ -999,7 +999,7 @@ describe( 'downcast converters', () => {
 				writer.setAttribute( 'headingRows', 2, table );
 				writer.setAttribute( 'headingRows', 2, table );
 			} );
 			} );
 
 
-			expect( formatTable( getViewData( viewDocument, { withoutSelection: true } ) ) ).to.equal( formattedViewTable( [
+			assertEqualMarkup( getViewData( viewDocument, { withoutSelection: true } ), viewTable( [
 				[ '00', '01' ],
 				[ '00', '01' ],
 				[ '10', '11' ]
 				[ '10', '11' ]
 			], { headingRows: 2 } ) );
 			], { headingRows: 2 } ) );
@@ -1015,7 +1015,7 @@ describe( 'downcast converters', () => {
 				writer.setAttribute( 'headingRows', 1, table );
 				writer.setAttribute( 'headingRows', 1, table );
 			} );
 			} );
 
 
-			expect( formatTable( getViewData( viewDocument, { withoutSelection: true } ) ) ).to.equal( formatTable(
+			assertEqualMarkup( getViewData( viewDocument, { withoutSelection: true } ),
 				'<figure class="table" headingRows="1">' +
 				'<figure class="table" headingRows="1">' +
 					'<table>' +
 					'<table>' +
 						'<tbody>' +
 						'<tbody>' +
@@ -1023,7 +1023,7 @@ describe( 'downcast converters', () => {
 						'</tbody>' +
 						'</tbody>' +
 					'</table>' +
 					'</table>' +
 				'</figure>'
 				'</figure>'
-			) );
+			);
 		} );
 		} );
 
 
 		it( 'should work with adding table rows at the beginning of a table', () => {
 		it( 'should work with adding table rows at the beginning of a table', () => {
@@ -1044,7 +1044,7 @@ describe( 'downcast converters', () => {
 				writer.insertElement( 'tableCell', tableRow, 'end' );
 				writer.insertElement( 'tableCell', tableRow, 'end' );
 			} );
 			} );
 
 
-			expect( formatTable( getViewData( viewDocument, { withoutSelection: true } ) ) ).to.equal( formattedViewTable( [
+			assertEqualMarkup( getViewData( viewDocument, { withoutSelection: true } ), viewTable( [
 				[ '', '' ],
 				[ '', '' ],
 				[ '00', '01' ],
 				[ '00', '01' ],
 				[ '10', '11' ]
 				[ '10', '11' ]
@@ -1070,7 +1070,7 @@ describe( 'downcast converters', () => {
 				writer.insertElement( 'tableCell', tableRow, 'end' );
 				writer.insertElement( 'tableCell', tableRow, 'end' );
 			} );
 			} );
 
 
-			expect( formatTable( getViewData( viewDocument, { withoutSelection: true } ) ) ).to.equal( formattedViewTable( [
+			assertEqualMarkup( getViewData( viewDocument, { withoutSelection: true } ), viewTable( [
 				[ '00', '01' ],
 				[ '00', '01' ],
 				[ '', '' ],
 				[ '', '' ],
 				[ '10', '11' ],
 				[ '10', '11' ],
@@ -1102,7 +1102,7 @@ describe( 'downcast converters', () => {
 					writer.setAttribute( 'headingColumns', 1, table );
 					writer.setAttribute( 'headingColumns', 1, table );
 				} );
 				} );
 
 
-				expect( formatTable( getViewData( viewDocument, { withoutSelection: true } ) ) ).to.equal( formatTable(
+				assertEqualMarkup( getViewData( viewDocument, { withoutSelection: true } ),
 					'<figure class="ck-widget ck-widget_with-selection-handle table" contenteditable="false">' +
 					'<figure class="ck-widget ck-widget_with-selection-handle table" contenteditable="false">' +
 					'<div class="ck ck-widget__selection-handle"></div>' +
 					'<div class="ck ck-widget__selection-handle"></div>' +
 						'<table>' +
 						'<table>' +
@@ -1115,7 +1115,7 @@ describe( 'downcast converters', () => {
 							'</tbody>' +
 							'</tbody>' +
 						'</table>' +
 						'</table>' +
 					'</figure>'
 					'</figure>'
-				) );
+				);
 			} );
 			} );
 		} );
 		} );
 	} );
 	} );
@@ -1133,7 +1133,7 @@ describe( 'downcast converters', () => {
 				writer.remove( table.getChild( 1 ) );
 				writer.remove( table.getChild( 1 ) );
 			} );
 			} );
 
 
-			expect( formatTable( getViewData( viewDocument, { withoutSelection: true } ) ) ).to.equal( formattedViewTable( [
+			assertEqualMarkup( getViewData( viewDocument, { withoutSelection: true } ), viewTable( [
 				[ '00', '01' ]
 				[ '00', '01' ]
 			] ) );
 			] ) );
 		} );
 		} );
@@ -1150,7 +1150,7 @@ describe( 'downcast converters', () => {
 				writer.remove( table.getChild( 0 ) );
 				writer.remove( table.getChild( 0 ) );
 			} );
 			} );
 
 
-			expect( formatTable( getViewData( viewDocument, { withoutSelection: true } ) ) ).to.equal( formattedViewTable( [
+			assertEqualMarkup( getViewData( viewDocument, { withoutSelection: true } ), viewTable( [
 				[ '10', '11' ]
 				[ '10', '11' ]
 			] ) );
 			] ) );
 		} );
 		} );
@@ -1167,7 +1167,7 @@ describe( 'downcast converters', () => {
 				writer.remove( table.getChild( 1 ) );
 				writer.remove( table.getChild( 1 ) );
 			} );
 			} );
 
 
-			expect( formatTable( getViewData( viewDocument, { withoutSelection: true } ) ) ).to.equal( formattedViewTable( [
+			assertEqualMarkup( getViewData( viewDocument, { withoutSelection: true } ), viewTable( [
 				[ '00', '01' ]
 				[ '00', '01' ]
 			], { headingRows: 2 } ) );
 			], { headingRows: 2 } ) );
 		} );
 		} );
@@ -1184,7 +1184,7 @@ describe( 'downcast converters', () => {
 				writer.remove( table.getChild( 0 ) );
 				writer.remove( table.getChild( 0 ) );
 			} );
 			} );
 
 
-			expect( formatTable( getViewData( viewDocument, { withoutSelection: true } ) ) ).to.equal( formattedViewTable( [
+			assertEqualMarkup( getViewData( viewDocument, { withoutSelection: true } ), viewTable( [
 				[ '10', '11' ]
 				[ '10', '11' ]
 			], { headingRows: 2 } ) );
 			], { headingRows: 2 } ) );
 		} );
 		} );
@@ -1202,7 +1202,7 @@ describe( 'downcast converters', () => {
 				writer.remove( table.getChild( 0 ) );
 				writer.remove( table.getChild( 0 ) );
 			} );
 			} );
 
 
-			expect( formatTable( getViewData( viewDocument, { withoutSelection: true } ) ) ).to.equal( formattedViewTable( [
+			assertEqualMarkup( getViewData( viewDocument, { withoutSelection: true } ), viewTable( [
 				[ '10', '11' ]
 				[ '10', '11' ]
 			] ) );
 			] ) );
 		} );
 		} );
@@ -1219,7 +1219,7 @@ describe( 'downcast converters', () => {
 				writer.remove( table.getChild( 1 ) );
 				writer.remove( table.getChild( 1 ) );
 			} );
 			} );
 
 
-			expect( formatTable( getViewData( viewDocument, { withoutSelection: true } ) ) ).to.equal( formattedViewTable( [
+			assertEqualMarkup( getViewData( viewDocument, { withoutSelection: true } ), viewTable( [
 				[ '00', '01' ]
 				[ '00', '01' ]
 			], { headingRows: 1 } ) );
 			], { headingRows: 1 } ) );
 		} );
 		} );
@@ -1247,7 +1247,7 @@ describe( 'downcast converters', () => {
 				[ '00[]' ]
 				[ '00[]' ]
 			] ) );
 			] ) );
 
 
-			expect( formatTable( getViewData( viewDocument, { withoutSelection: true } ) ) ).to.equal( formattedViewTable( [
+			assertEqualMarkup( getViewData( viewDocument, { withoutSelection: true } ), viewTable( [
 				[ '00' ]
 				[ '00' ]
 			], { asWidget: true } ) );
 			], { asWidget: true } ) );
 
 
@@ -1263,7 +1263,7 @@ describe( 'downcast converters', () => {
 				writer.setSelection( nodeByPath.nextSibling, 0 );
 				writer.setSelection( nodeByPath.nextSibling, 0 );
 			} );
 			} );
 
 
-			expect( formatTable( getViewData( viewDocument, { withoutSelection: true } ) ) ).to.equal( formattedViewTable( [
+			assertEqualMarkup( getViewData( viewDocument, { withoutSelection: true } ), viewTable( [
 				[ '<p>00</p><p></p>' ]
 				[ '<p>00</p><p></p>' ]
 			], { asWidget: true } ) );
 			], { asWidget: true } ) );
 		} );
 		} );
@@ -1276,7 +1276,7 @@ describe( 'downcast converters', () => {
 				[ '<paragraph foo="bar">00[]</paragraph>' ]
 				[ '<paragraph foo="bar">00[]</paragraph>' ]
 			] ) );
 			] ) );
 
 
-			expect( formatTable( getViewData( viewDocument, { withoutSelection: true } ) ) ).to.equal( formattedViewTable( [
+			assertEqualMarkup( getViewData( viewDocument, { withoutSelection: true } ), viewTable( [
 				[ '<p foo="bar">00</p>' ]
 				[ '<p foo="bar">00</p>' ]
 			], { asWidget: true } ) );
 			], { asWidget: true } ) );
 		} );
 		} );

+ 15 - 15
packages/ckeditor5-table/tests/converters/table-cell-paragraph-post-fixer.js

@@ -8,8 +8,8 @@ import VirtualTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/virtualtest
 import { getData as getModelData, setData as setModelData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model';
 import { getData as getModelData, setData as setModelData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model';
 
 
 import TableEditing from '../../src/tableediting';
 import TableEditing from '../../src/tableediting';
-import { formatTable } from './../_utils/utils';
 import UndoEditing from '@ckeditor/ckeditor5-undo/src/undoediting';
 import UndoEditing from '@ckeditor/ckeditor5-undo/src/undoediting';
+import { assertEqualMarkup } from '@ckeditor/ckeditor5-utils/tests/_utils/utils';
 
 
 describe( 'Table cell paragraph post-fixer', () => {
 describe( 'Table cell paragraph post-fixer', () => {
 	let editor, model, root;
 	let editor, model, root;
@@ -39,13 +39,13 @@ describe( 'Table cell paragraph post-fixer', () => {
 			'</table>'
 			'</table>'
 		);
 		);
 
 
-		expect( formatTable( getModelData( model, { withoutSelection: true } ) ) ).to.equal( formatTable(
+		assertEqualMarkup( getModelData( model, { withoutSelection: true } ),
 			'<table>' +
 			'<table>' +
 				'<tableRow>' +
 				'<tableRow>' +
 					'<tableCell><paragraph></paragraph></tableCell>' +
 					'<tableCell><paragraph></paragraph></tableCell>' +
 				'</tableRow>' +
 				'</tableRow>' +
 			'</table>'
 			'</table>'
-		) );
+		);
 	} );
 	} );
 
 
 	it( 'should add a paragraph to an empty table cell (on row insert)', () => {
 	it( 'should add a paragraph to an empty table cell (on row insert)', () => {
@@ -63,7 +63,7 @@ describe( 'Table cell paragraph post-fixer', () => {
 			writer.insertElement( 'tableCell', writer.createPositionAt( root.getNodeByPath( [ 0, 1 ] ), 0 ) );
 			writer.insertElement( 'tableCell', writer.createPositionAt( root.getNodeByPath( [ 0, 1 ] ), 0 ) );
 		} );
 		} );
 
 
-		expect( formatTable( getModelData( model, { withoutSelection: true } ) ) ).to.equal( formatTable(
+		assertEqualMarkup( getModelData( model, { withoutSelection: true } ),
 			'<table>' +
 			'<table>' +
 				'<tableRow>' +
 				'<tableRow>' +
 					'<tableCell><paragraph></paragraph></tableCell>' +
 					'<tableCell><paragraph></paragraph></tableCell>' +
@@ -72,7 +72,7 @@ describe( 'Table cell paragraph post-fixer', () => {
 					'<tableCell><paragraph></paragraph></tableCell>' +
 					'<tableCell><paragraph></paragraph></tableCell>' +
 				'</tableRow>' +
 				'</tableRow>' +
 			'</table>'
 			'</table>'
-		) );
+		);
 	} );
 	} );
 
 
 	it( 'should add a paragraph to an empty table cell (on table cell insert)', () => {
 	it( 'should add a paragraph to an empty table cell (on table cell insert)', () => {
@@ -89,14 +89,14 @@ describe( 'Table cell paragraph post-fixer', () => {
 			writer.insertElement( 'tableCell', writer.createPositionAt( root.getNodeByPath( [ 0, 0 ] ), 'end' ) );
 			writer.insertElement( 'tableCell', writer.createPositionAt( root.getNodeByPath( [ 0, 0 ] ), 'end' ) );
 		} );
 		} );
 
 
-		expect( formatTable( getModelData( model, { withoutSelection: true } ) ) ).to.equal( formatTable(
+		assertEqualMarkup( getModelData( model, { withoutSelection: true } ),
 			'<table>' +
 			'<table>' +
 				'<tableRow>' +
 				'<tableRow>' +
 					'<tableCell><paragraph></paragraph></tableCell>' +
 					'<tableCell><paragraph></paragraph></tableCell>' +
 					'<tableCell><paragraph></paragraph></tableCell>' +
 					'<tableCell><paragraph></paragraph></tableCell>' +
 				'</tableRow>' +
 				'</tableRow>' +
 			'</table>'
 			'</table>'
-		) );
+		);
 	} );
 	} );
 
 
 	it( 'should add a paragraph to an empty table cell (after remove)', () => {
 	it( 'should add a paragraph to an empty table cell (after remove)', () => {
@@ -113,13 +113,13 @@ describe( 'Table cell paragraph post-fixer', () => {
 			writer.remove( writer.createRangeIn( root.getNodeByPath( [ 0, 0, 0 ] ) ) );
 			writer.remove( writer.createRangeIn( root.getNodeByPath( [ 0, 0, 0 ] ) ) );
 		} );
 		} );
 
 
-		expect( formatTable( getModelData( model, { withoutSelection: true } ) ) ).to.equal( formatTable(
+		assertEqualMarkup( getModelData( model, { withoutSelection: true } ),
 			'<table>' +
 			'<table>' +
 				'<tableRow>' +
 				'<tableRow>' +
 					'<tableCell><paragraph></paragraph></tableCell>' +
 					'<tableCell><paragraph></paragraph></tableCell>' +
 				'</tableRow>' +
 				'</tableRow>' +
 			'</table>'
 			'</table>'
-		) );
+		);
 	} );
 	} );
 
 
 	it( 'should wrap in paragraph $text nodes placed directly in tableCell (on table cell modification) ', () => {
 	it( 'should wrap in paragraph $text nodes placed directly in tableCell (on table cell modification) ', () => {
@@ -143,7 +143,7 @@ describe( 'Table cell paragraph post-fixer', () => {
 			writer.insertText( 'baz', root.getNodeByPath( [ 0, 0, 0 ] ), 'end' );
 			writer.insertText( 'baz', root.getNodeByPath( [ 0, 0, 0 ] ), 'end' );
 		} );
 		} );
 
 
-		expect( formatTable( getModelData( model, { withoutSelection: true } ) ) ).to.equal( formatTable(
+		assertEqualMarkup( getModelData( model, { withoutSelection: true } ),
 			'<table>' +
 			'<table>' +
 				'<tableRow>' +
 				'<tableRow>' +
 					'<tableCell>' +
 					'<tableCell>' +
@@ -153,7 +153,7 @@ describe( 'Table cell paragraph post-fixer', () => {
 					'</tableCell>' +
 					'</tableCell>' +
 				'</tableRow>' +
 				'</tableRow>' +
 			'</table>'
 			'</table>'
-		) );
+		);
 	} );
 	} );
 
 
 	it( 'should wrap in paragraph $text nodes placed directly in tableCell (on inserting table cell)', () => {
 	it( 'should wrap in paragraph $text nodes placed directly in tableCell (on inserting table cell)', () => {
@@ -173,7 +173,7 @@ describe( 'Table cell paragraph post-fixer', () => {
 			writer.insert( tableCell, writer.createPositionAt( root.getNodeByPath( [ 0, 0 ] ), 'end' ) );
 			writer.insert( tableCell, writer.createPositionAt( root.getNodeByPath( [ 0, 0 ] ), 'end' ) );
 		} );
 		} );
 
 
-		expect( formatTable( getModelData( model, { withoutSelection: true } ) ) ).to.equal( formatTable(
+		assertEqualMarkup( getModelData( model, { withoutSelection: true } ),
 			'<table>' +
 			'<table>' +
 				'<tableRow>' +
 				'<tableRow>' +
 					'<tableCell>' +
 					'<tableCell>' +
@@ -184,7 +184,7 @@ describe( 'Table cell paragraph post-fixer', () => {
 					'</tableCell>' +
 					'</tableCell>' +
 				'</tableRow>' +
 				'</tableRow>' +
 			'</table>'
 			'</table>'
-		) );
+		);
 	} );
 	} );
 
 
 	it( 'should wrap in paragraph $text nodes placed directly in tableCell (on inserting table rows)', () => {
 	it( 'should wrap in paragraph $text nodes placed directly in tableCell (on inserting table rows)', () => {
@@ -206,7 +206,7 @@ describe( 'Table cell paragraph post-fixer', () => {
 			writer.insert( tableRow, writer.createPositionAt( root.getNodeByPath( [ 0 ] ), 'end' ) );
 			writer.insert( tableRow, writer.createPositionAt( root.getNodeByPath( [ 0 ] ), 'end' ) );
 		} );
 		} );
 
 
-		expect( formatTable( getModelData( model, { withoutSelection: true } ) ) ).to.equal( formatTable(
+		assertEqualMarkup( getModelData( model, { withoutSelection: true } ),
 			'<table>' +
 			'<table>' +
 				'<tableRow>' +
 				'<tableRow>' +
 					'<tableCell>' +
 					'<tableCell>' +
@@ -219,6 +219,6 @@ describe( 'Table cell paragraph post-fixer', () => {
 					'</tableCell>' +
 					'</tableCell>' +
 				'</tableRow>' +
 				'</tableRow>' +
 			'</table>'
 			'</table>'
-		) );
+		);
 	} );
 	} );
 } );
 } );

+ 16 - 15
packages/ckeditor5-table/tests/converters/table-cell-refresh-post-fixer.js

@@ -7,7 +7,7 @@
 
 
 import { getData as getViewData } from '@ckeditor/ckeditor5-engine/src/dev-utils/view';
 import { getData as getViewData } from '@ckeditor/ckeditor5-engine/src/dev-utils/view';
 
 
-import { defaultConversion, defaultSchema, formatTable, formattedViewTable, viewTable } from '../_utils/utils';
+import { defaultConversion, defaultSchema, viewTable } from '../_utils/utils';
 import injectTableCellRefreshPostFixer from '../../src/converters/table-cell-refresh-post-fixer';
 import injectTableCellRefreshPostFixer from '../../src/converters/table-cell-refresh-post-fixer';
 
 
 import env from '@ckeditor/ckeditor5-utils/src/env';
 import env from '@ckeditor/ckeditor5-utils/src/env';
@@ -15,6 +15,7 @@ import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';
 import ClassicTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/classictesteditor';
 import ClassicTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/classictesteditor';
 
 
 import Delete from '@ckeditor/ckeditor5-typing/src/delete';
 import Delete from '@ckeditor/ckeditor5-typing/src/delete';
+import { assertEqualMarkup } from '@ckeditor/ckeditor5-utils/tests/_utils/utils';
 
 
 describe( 'Table cell refresh post-fixer', () => {
 describe( 'Table cell refresh post-fixer', () => {
 	let editor, model, doc, root, view, refreshItemSpy;
 	let editor, model, doc, root, view, refreshItemSpy;
@@ -68,7 +69,7 @@ describe( 'Table cell refresh post-fixer', () => {
 			writer.setSelection( nodeByPath.nextSibling, 0 );
 			writer.setSelection( nodeByPath.nextSibling, 0 );
 		} );
 		} );
 
 
-		expect( formatTable( getViewData( view, { withoutSelection: true } ) ) ).to.equal( formattedViewTable( [
+		assertEqualMarkup( getViewData( view, { withoutSelection: true } ), viewTable( [
 			[ '<p>00</p><p></p>' ]
 			[ '<p>00</p><p></p>' ]
 		], { asWidget: true } ) );
 		], { asWidget: true } ) );
 		sinon.assert.calledOnce( refreshItemSpy );
 		sinon.assert.calledOnce( refreshItemSpy );
@@ -89,7 +90,7 @@ describe( 'Table cell refresh post-fixer', () => {
 			writer.setSelection( nodeByPath.nextSibling, 0 );
 			writer.setSelection( nodeByPath.nextSibling, 0 );
 		} );
 		} );
 
 
-		expect( formatTable( getViewData( view, { withoutSelection: true } ) ) ).to.equal( formattedViewTable( [
+		assertEqualMarkup( getViewData( view, { withoutSelection: true } ), viewTable( [
 			[ '<p>00</p><div></div>' ]
 			[ '<p>00</p><div></div>' ]
 		], { asWidget: true } ) );
 		], { asWidget: true } ) );
 		sinon.assert.calledOnce( refreshItemSpy );
 		sinon.assert.calledOnce( refreshItemSpy );
@@ -108,7 +109,7 @@ describe( 'Table cell refresh post-fixer', () => {
 			writer.setSelection( nodeByPath.nextSibling, 0 );
 			writer.setSelection( nodeByPath.nextSibling, 0 );
 		} );
 		} );
 
 
-		expect( formatTable( getViewData( view, { withoutSelection: true } ) ) ).to.equal( formattedViewTable( [
+		assertEqualMarkup( getViewData( view, { withoutSelection: true } ), viewTable( [
 			[ '<p>00</p><p></p>' ]
 			[ '<p>00</p><p></p>' ]
 		], { asWidget: true } ) );
 		], { asWidget: true } ) );
 		sinon.assert.calledOnce( refreshItemSpy );
 		sinon.assert.calledOnce( refreshItemSpy );
@@ -117,7 +118,7 @@ describe( 'Table cell refresh post-fixer', () => {
 			writer.remove( table.getNodeByPath( [ 0, 0, 1 ] ) );
 			writer.remove( table.getNodeByPath( [ 0, 0, 1 ] ) );
 		} );
 		} );
 
 
-		expect( formatTable( getViewData( view, { withoutSelection: true } ) ) ).to.equal( formattedViewTable( [
+		assertEqualMarkup( getViewData( view, { withoutSelection: true } ), viewTable( [
 			[ '00' ]
 			[ '00' ]
 		], { asWidget: true } ) );
 		], { asWidget: true } ) );
 		sinon.assert.calledTwice( refreshItemSpy );
 		sinon.assert.calledTwice( refreshItemSpy );
@@ -132,7 +133,7 @@ describe( 'Table cell refresh post-fixer', () => {
 			writer.setAttribute( 'foo', 'bar', table.getNodeByPath( [ 0, 0, 0 ] ) );
 			writer.setAttribute( 'foo', 'bar', table.getNodeByPath( [ 0, 0, 0 ] ) );
 		} );
 		} );
 
 
-		expect( formatTable( getViewData( view, { withoutSelection: true } ) ) ).to.equal( formattedViewTable( [
+		assertEqualMarkup( getViewData( view, { withoutSelection: true } ), viewTable( [
 			[ '<p foo="bar">00</p>' ]
 			[ '<p foo="bar">00</p>' ]
 		], { asWidget: true } ) );
 		], { asWidget: true } ) );
 		sinon.assert.calledOnce( refreshItemSpy );
 		sinon.assert.calledOnce( refreshItemSpy );
@@ -147,7 +148,7 @@ describe( 'Table cell refresh post-fixer', () => {
 			writer.remove( table.getNodeByPath( [ 0, 0, 1 ] ) );
 			writer.remove( table.getNodeByPath( [ 0, 0, 1 ] ) );
 		} );
 		} );
 
 
-		expect( formatTable( getViewData( view, { withoutSelection: true } ) ) ).to.equal( formattedViewTable( [
+		assertEqualMarkup( getViewData( view, { withoutSelection: true } ), viewTable( [
 			[ '00' ]
 			[ '00' ]
 		], { asWidget: true } ) );
 		], { asWidget: true } ) );
 		sinon.assert.calledOnce( refreshItemSpy );
 		sinon.assert.calledOnce( refreshItemSpy );
@@ -162,7 +163,7 @@ describe( 'Table cell refresh post-fixer', () => {
 			writer.removeAttribute( 'foo', table.getNodeByPath( [ 0, 0, 0 ] ) );
 			writer.removeAttribute( 'foo', table.getNodeByPath( [ 0, 0, 0 ] ) );
 		} );
 		} );
 
 
-		expect( formatTable( getViewData( view, { withoutSelection: true } ) ) ).to.equal( formattedViewTable( [
+		assertEqualMarkup( getViewData( view, { withoutSelection: true } ), viewTable( [
 			[ '<span>00</span>' ]
 			[ '<span>00</span>' ]
 		], { asWidget: true } ) );
 		], { asWidget: true } ) );
 		sinon.assert.calledOnce( refreshItemSpy );
 		sinon.assert.calledOnce( refreshItemSpy );
@@ -177,7 +178,7 @@ describe( 'Table cell refresh post-fixer', () => {
 			writer.setAttribute( 'foo', 'baz', table.getNodeByPath( [ 0, 0, 0 ] ) );
 			writer.setAttribute( 'foo', 'baz', table.getNodeByPath( [ 0, 0, 0 ] ) );
 		} );
 		} );
 
 
-		expect( formatTable( getViewData( view, { withoutSelection: true } ) ) ).to.equal( formattedViewTable( [
+		assertEqualMarkup( getViewData( view, { withoutSelection: true } ), viewTable( [
 			[ '<p foo="baz">00</p>' ]
 			[ '<p foo="baz">00</p>' ]
 		], { asWidget: true } ) );
 		], { asWidget: true } ) );
 		// False positive: should not be called.
 		// False positive: should not be called.
@@ -193,7 +194,7 @@ describe( 'Table cell refresh post-fixer', () => {
 			writer.setAttribute( 'bar', 'bar', table.getNodeByPath( [ 0, 0, 0 ] ) );
 			writer.setAttribute( 'bar', 'bar', table.getNodeByPath( [ 0, 0, 0 ] ) );
 		} );
 		} );
 
 
-		expect( formatTable( getViewData( view, { withoutSelection: true } ) ) ).to.equal( formattedViewTable( [
+		assertEqualMarkup( getViewData( view, { withoutSelection: true } ), viewTable( [
 			[ '<p bar="bar" foo="bar">00</p>' ]
 			[ '<p bar="bar" foo="bar">00</p>' ]
 		], { asWidget: true } ) );
 		], { asWidget: true } ) );
 
 
@@ -211,7 +212,7 @@ describe( 'Table cell refresh post-fixer', () => {
 			writer.removeAttribute( 'foo', table.getNodeByPath( [ 0, 0, 0 ] ) );
 			writer.removeAttribute( 'foo', table.getNodeByPath( [ 0, 0, 0 ] ) );
 		} );
 		} );
 
 
-		expect( formatTable( getViewData( view, { withoutSelection: true } ) ) ).to.equal( formattedViewTable( [
+		assertEqualMarkup( getViewData( view, { withoutSelection: true } ), viewTable( [
 			[ '<p bar="bar">00</p>' ]
 			[ '<p bar="bar">00</p>' ]
 		], { asWidget: true } ) );
 		], { asWidget: true } ) );
 		// False positive: should not be called.
 		// False positive: should not be called.
@@ -227,7 +228,7 @@ describe( 'Table cell refresh post-fixer', () => {
 			writer.setAttribute( 'foo', 'baz', table.getNodeByPath( [ 0, 0, 0 ] ) );
 			writer.setAttribute( 'foo', 'baz', table.getNodeByPath( [ 0, 0, 0 ] ) );
 		} );
 		} );
 
 
-		expect( formatTable( getViewData( view, { withoutSelection: true } ) ) ).to.equal( formattedViewTable( [
+		assertEqualMarkup( getViewData( view, { withoutSelection: true } ), viewTable( [
 			[ '<p foo="baz">00</p><p>00</p>' ]
 			[ '<p foo="baz">00</p><p>00</p>' ]
 		], { asWidget: true } ) );
 		], { asWidget: true } ) );
 		sinon.assert.notCalled( refreshItemSpy );
 		sinon.assert.notCalled( refreshItemSpy );
@@ -242,7 +243,7 @@ describe( 'Table cell refresh post-fixer', () => {
 			writer.rename( table.getNodeByPath( [ 0, 0, 0 ] ), 'block' );
 			writer.rename( table.getNodeByPath( [ 0, 0, 0 ] ), 'block' );
 		} );
 		} );
 
 
-		expect( formatTable( getViewData( view, { withoutSelection: true } ) ) ).to.equal( formattedViewTable( [
+		assertEqualMarkup( getViewData( view, { withoutSelection: true } ), viewTable( [
 			[ '<div>00</div>' ]
 			[ '<div>00</div>' ]
 		], { asWidget: true } ) );
 		], { asWidget: true } ) );
 		sinon.assert.notCalled( refreshItemSpy );
 		sinon.assert.notCalled( refreshItemSpy );
@@ -257,7 +258,7 @@ describe( 'Table cell refresh post-fixer', () => {
 			writer.setAttribute( 'foo', 'bar', table.getNodeByPath( [ 0, 0, 0 ] ) );
 			writer.setAttribute( 'foo', 'bar', table.getNodeByPath( [ 0, 0, 0 ] ) );
 		} );
 		} );
 
 
-		expect( formatTable( getViewData( view, { withoutSelection: true } ) ) ).to.equal( formattedViewTable( [
+		assertEqualMarkup( getViewData( view, { withoutSelection: true } ), viewTable( [
 			[ '<div foo="bar">foo</div>' ]
 			[ '<div foo="bar">foo</div>' ]
 		], { asWidget: true } ) );
 		], { asWidget: true } ) );
 		sinon.assert.notCalled( refreshItemSpy );
 		sinon.assert.notCalled( refreshItemSpy );
@@ -272,7 +273,7 @@ describe( 'Table cell refresh post-fixer', () => {
 			writer.remove( writer.createRangeOn( table.getNodeByPath( [ 0, 0, 1 ] ) ) );
 			writer.remove( writer.createRangeOn( table.getNodeByPath( [ 0, 0, 1 ] ) ) );
 		} );
 		} );
 
 
-		expect( formatTable( getViewData( view, { withoutSelection: true } ) ) ).to.equal( formattedViewTable( [
+		assertEqualMarkup( getViewData( view, { withoutSelection: true } ), viewTable( [
 			[ '<span>00</span>' ]
 			[ '<span>00</span>' ]
 		], { asWidget: true } ) );
 		], { asWidget: true } ) );
 		sinon.assert.calledOnce( refreshItemSpy );
 		sinon.assert.calledOnce( refreshItemSpy );

+ 30 - 29
packages/ckeditor5-table/tests/converters/table-layout-post-fixer.js

@@ -8,8 +8,9 @@ import VirtualTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/virtualtest
 import { getData as getModelData, parse, setData as setModelData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model';
 import { getData as getModelData, parse, setData as setModelData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model';
 
 
 import TableEditing from '../../src/tableediting';
 import TableEditing from '../../src/tableediting';
-import { formatTable, formattedModelTable, modelTable } from './../_utils/utils';
+import { modelTable } from './../_utils/utils';
 import UndoEditing from '@ckeditor/ckeditor5-undo/src/undoediting';
 import UndoEditing from '@ckeditor/ckeditor5-undo/src/undoediting';
+import { assertEqualMarkup } from '@ckeditor/ckeditor5-utils/tests/_utils/utils';
 
 
 describe( 'Table layout post-fixer', () => {
 describe( 'Table layout post-fixer', () => {
 	let editor, model, root;
 	let editor, model, root;
@@ -43,7 +44,7 @@ describe( 'Table layout post-fixer', () => {
 				writer.insert( parsed, root );
 				writer.insert( parsed, root );
 			} );
 			} );
 
 
-			expect( formatTable( getModelData( model, { withoutSelection: true } ) ) ).to.equal( formattedModelTable( [
+			assertEqualMarkup( getModelData( model, { withoutSelection: true } ), modelTable( [
 				[ '00', '', '' ],
 				[ '00', '', '' ],
 				[ '10', '11', '12' ],
 				[ '10', '11', '12' ],
 				[ '20', '21', '' ]
 				[ '20', '21', '' ]
@@ -62,7 +63,7 @@ describe( 'Table layout post-fixer', () => {
 				writer.insert( parsed, root );
 				writer.insert( parsed, root );
 			} );
 			} );
 
 
-			expect( formatTable( getModelData( model, { withoutSelection: true } ) ) ).to.equal( formattedModelTable( [
+			assertEqualMarkup( getModelData( model, { withoutSelection: true } ), modelTable( [
 				[ '00', { rowspan: 2, contents: '10' }, '', '' ],
 				[ '00', { rowspan: 2, contents: '10' }, '', '' ],
 				[ '10', { colspan: 2, contents: '12' } ],
 				[ '10', { colspan: 2, contents: '12' } ],
 				[ '20', '21', '', '' ]
 				[ '20', '21', '', '' ]
@@ -81,7 +82,7 @@ describe( 'Table layout post-fixer', () => {
 				writer.insert( parsed, root );
 				writer.insert( parsed, root );
 			} );
 			} );
 
 
-			expect( formatTable( getModelData( model, { withoutSelection: true } ) ) ).to.equal( formattedModelTable( [
+			assertEqualMarkup( getModelData( model, { withoutSelection: true } ), modelTable( [
 				[ { colspan: 6, contents: '00' } ],
 				[ { colspan: 6, contents: '00' } ],
 				[ { rowspan: 2, contents: '10' }, '11', { colspan: 3, contents: '12' }, '' ],
 				[ { rowspan: 2, contents: '10' }, '11', { colspan: 3, contents: '12' }, '' ],
 				[ '21', '22', '', '', '' ]
 				[ '21', '22', '', '', '' ]
@@ -100,7 +101,7 @@ describe( 'Table layout post-fixer', () => {
 				writer.insert( parsed, root );
 				writer.insert( parsed, root );
 			} );
 			} );
 
 
-			expect( formatTable( getModelData( model, { withoutSelection: true } ) ) ).to.equal( formattedModelTable( [
+			assertEqualMarkup( getModelData( model, { withoutSelection: true } ), modelTable( [
 				[ { rowspan: 2, contents: '00' }, { rowspan: 2, contents: '01' }, '02' ],
 				[ { rowspan: 2, contents: '00' }, { rowspan: 2, contents: '01' }, '02' ],
 				[ '12' ],
 				[ '12' ],
 				[ '20', '21', '22' ]
 				[ '20', '21', '22' ]
@@ -119,7 +120,7 @@ describe( 'Table layout post-fixer', () => {
 				writer.insert( parsed, root );
 				writer.insert( parsed, root );
 			} );
 			} );
 
 
-			expect( formatTable( getModelData( model, { withoutSelection: true } ) ) ).to.equal( formattedModelTable( [
+			assertEqualMarkup( getModelData( model, { withoutSelection: true } ), modelTable( [
 				[ '00', '01', '02' ],
 				[ '00', '01', '02' ],
 				[ { rowspan: 2, contents: '10' }, { rowspan: 2, contents: '11' }, '12' ],
 				[ { rowspan: 2, contents: '10' }, { rowspan: 2, contents: '11' }, '12' ],
 				[ '22' ]
 				[ '22' ]
@@ -147,22 +148,22 @@ describe( 'Table layout post-fixer', () => {
 				writer.insert( parsed, root );
 				writer.insert( parsed, root );
 			} );
 			} );
 
 
-			const expectedTableA = formattedModelTable( [
+			const expectedTableA = modelTable( [
 				[ '11', '' ],
 				[ '11', '' ],
 				[ '21', '22' ]
 				[ '21', '22' ]
 			] );
 			] );
-			const expectedTableB = formattedModelTable( [
+			const expectedTableB = modelTable( [
 				[ 'aa', 'ab' ],
 				[ 'aa', 'ab' ],
 				[ 'ba', 'bb' ]
 				[ 'ba', 'bb' ]
 			] );
 			] );
-			const expectedTableC = formattedModelTable( [
+			const expectedTableC = modelTable( [
 				[ 'xx', '' ],
 				[ 'xx', '' ],
 				[ 'yy', 'yy' ]
 				[ 'yy', 'yy' ]
 			] );
 			] );
 
 
 			const expectedTables = expectedTableA + expectedTableB + expectedTableC;
 			const expectedTables = expectedTableA + expectedTableB + expectedTableC;
 
 
-			expect( formatTable( getModelData( model, { withoutSelection: true } ) ) ).to.equal( expectedTables );
+			assertEqualMarkup( getModelData( model, { withoutSelection: true } ), expectedTables );
 		} );
 		} );
 
 
 		it( 'should not crash on table remove', () => {
 		it( 'should not crash on table remove', () => {
@@ -190,13 +191,13 @@ describe( 'Table layout post-fixer', () => {
 				writer => _removeColumn( writer, 1, [ 0, 1 ] ),
 				writer => _removeColumn( writer, 1, [ 0, 1 ] ),
 				writer => _insertRow( writer, 1, [ 'a', 'b' ] ),
 				writer => _insertRow( writer, 1, [ 'a', 'b' ] ),
 				// Table should have added empty cells.
 				// Table should have added empty cells.
-				formattedModelTable( [
+				modelTable( [
 					[ '00', '' ],
 					[ '00', '' ],
 					[ 'a', 'b' ],
 					[ 'a', 'b' ],
 					[ '10', '' ]
 					[ '10', '' ]
 				] ),
 				] ),
 				// Table will have empty column after undo.
 				// Table will have empty column after undo.
-				formattedModelTable( [
+				modelTable( [
 					[ '00', '01', '' ],
 					[ '00', '01', '' ],
 					[ 'a', 'b', '' ],
 					[ 'a', 'b', '' ],
 					[ '10', '11', '' ]
 					[ '10', '11', '' ]
@@ -212,13 +213,13 @@ describe( 'Table layout post-fixer', () => {
 				writer => _insertRow( writer, 1, [ 'a', 'b' ] ),
 				writer => _insertRow( writer, 1, [ 'a', 'b' ] ),
 				writer => _removeColumn( writer, 1, [ 0, 2 ] ),
 				writer => _removeColumn( writer, 1, [ 0, 2 ] ),
 				// There should be empty cells added.
 				// There should be empty cells added.
-				formattedModelTable( [
+				modelTable( [
 					[ '00', '' ],
 					[ '00', '' ],
 					[ 'a', 'b' ],
 					[ 'a', 'b' ],
 					[ '10', '' ]
 					[ '10', '' ]
 				] ),
 				] ),
 				// Table will have empty column after undo.
 				// Table will have empty column after undo.
-				formattedModelTable( [
+				modelTable( [
 					[ '00', '' ],
 					[ '00', '' ],
 					[ '10', '' ]
 					[ '10', '' ]
 				] ) );
 				] ) );
@@ -233,13 +234,13 @@ describe( 'Table layout post-fixer', () => {
 				writer => _insertRow( writer, 1, [ 'a', 'b' ] ),
 				writer => _insertRow( writer, 1, [ 'a', 'b' ] ),
 				writer => _insertColumn( writer, 1, [ 0, 2 ] ),
 				writer => _insertColumn( writer, 1, [ 0, 2 ] ),
 				// There should be empty cells added.
 				// There should be empty cells added.
-				formattedModelTable( [
+				modelTable( [
 					[ '00', '', '01' ],
 					[ '00', '', '01' ],
 					[ 'a', 'b', '' ],
 					[ 'a', 'b', '' ],
 					[ '10', '', '11' ]
 					[ '10', '', '11' ]
 				] ),
 				] ),
 				// Table will have empty column after undo.
 				// Table will have empty column after undo.
-				formattedModelTable( [
+				modelTable( [
 					[ '00', '', '01' ],
 					[ '00', '', '01' ],
 					[ '10', '', '11' ]
 					[ '10', '', '11' ]
 				] ) );
 				] ) );
@@ -254,13 +255,13 @@ describe( 'Table layout post-fixer', () => {
 				writer => _insertColumn( writer, 1, [ 0, 1 ] ),
 				writer => _insertColumn( writer, 1, [ 0, 1 ] ),
 				writer => _insertRow( writer, 1, [ 'a', 'b' ] ),
 				writer => _insertRow( writer, 1, [ 'a', 'b' ] ),
 				// There should be empty cells added.
 				// There should be empty cells added.
-				formattedModelTable( [
+				modelTable( [
 					[ '00', '', '01' ],
 					[ '00', '', '01' ],
 					[ 'a', 'b', '' ],
 					[ 'a', 'b', '' ],
 					[ '10', '', '11' ]
 					[ '10', '', '11' ]
 				] ),
 				] ),
 				// Table will have empty column after undo.
 				// Table will have empty column after undo.
-				formattedModelTable( [
+				modelTable( [
 					[ '00', '01', '' ],
 					[ '00', '01', '' ],
 					[ 'a', 'b', '' ],
 					[ 'a', 'b', '' ],
 					[ '10', '11', '' ]
 					[ '10', '11', '' ]
@@ -282,12 +283,12 @@ describe( 'Table layout post-fixer', () => {
 					_insertColumn( writer, 1, [ 1 ] );
 					_insertColumn( writer, 1, [ 1 ] );
 				},
 				},
 				// There should be empty cells added.
 				// There should be empty cells added.
-				formattedModelTable( [
+				modelTable( [
 					[ { colspan: 4, contents: '00' }, '' ],
 					[ { colspan: 4, contents: '00' }, '' ],
 					[ '10', '', '11', '', '12' ]
 					[ '10', '', '11', '', '12' ]
 				] ),
 				] ),
 				// Table will have empty column after undo.
 				// Table will have empty column after undo.
-				formattedModelTable( [
+				modelTable( [
 					[ { colspan: 3, contents: '00' }, '' ],
 					[ { colspan: 3, contents: '00' }, '' ],
 					[ '10', '', '11', '12' ]
 					[ '10', '', '11', '12' ]
 				] ) );
 				] ) );
@@ -308,12 +309,12 @@ describe( 'Table layout post-fixer', () => {
 					_insertColumn( writer, 3, [ 1 ] );
 					_insertColumn( writer, 3, [ 1 ] );
 				},
 				},
 				// There should be empty cells added.
 				// There should be empty cells added.
-				formattedModelTable( [
+				modelTable( [
 					[ { colspan: 4, contents: '00' }, '' ],
 					[ { colspan: 4, contents: '00' }, '' ],
 					[ '10', '', '11', '', '12' ]
 					[ '10', '', '11', '', '12' ]
 				] ),
 				] ),
 				// Table will have empty column after undo.
 				// Table will have empty column after undo.
-				formattedModelTable( [
+				modelTable( [
 					[ { colspan: 3, contents: '00' }, '' ],
 					[ { colspan: 3, contents: '00' }, '' ],
 					[ '10', '11', '', '12' ]
 					[ '10', '11', '', '12' ]
 				] ) );
 				] ) );
@@ -334,11 +335,11 @@ describe( 'Table layout post-fixer', () => {
 				writer => {
 				writer => {
 					_removeRow( writer, 1 );
 					_removeRow( writer, 1 );
 				},
 				},
-				formattedModelTable( [
+				modelTable( [
 					[ '11', '12', '13' ],
 					[ '11', '12', '13' ],
 					[ '31', '32', '33' ]
 					[ '31', '32', '33' ]
 				], { headingRows: 1 } ),
 				], { headingRows: 1 } ),
-				formattedModelTable( [
+				modelTable( [
 					[ '11', { rowspan: 2, contents: '12' }, '13', '' ],
 					[ '11', { rowspan: 2, contents: '12' }, '13', '' ],
 					[ '31', '32', '33' ]
 					[ '31', '32', '33' ]
 				] ) );
 				] ) );
@@ -358,11 +359,11 @@ describe( 'Table layout post-fixer', () => {
 					_setAttribute( writer, 'headingRows', 1, [ 0 ] );
 					_setAttribute( writer, 'headingRows', 1, [ 0 ] );
 					_removeAttribute( writer, 'rowspan', [ 0, 0, 1 ] );
 					_removeAttribute( writer, 'rowspan', [ 0, 0, 1 ] );
 				},
 				},
-				formattedModelTable( [
+				modelTable( [
 					[ '11', '12', '13', '' ],
 					[ '11', '12', '13', '' ],
 					[ '31', '32', '33', '' ]
 					[ '31', '32', '33', '' ]
 				], { headingRows: 1 } ),
 				], { headingRows: 1 } ),
-				formattedModelTable( [
+				modelTable( [
 					[ '11', '12', '13', '' ],
 					[ '11', '12', '13', '' ],
 					[ '21', '23', '', '' ],
 					[ '21', '23', '', '' ],
 					[ '31', '32', '33', '' ]
 					[ '31', '32', '33', '' ]
@@ -376,15 +377,15 @@ describe( 'Table layout post-fixer', () => {
 
 
 			model.enqueueChange( 'transparent', externalCallback );
 			model.enqueueChange( 'transparent', externalCallback );
 
 
-			expect( formatTable( getModelData( model, { withoutSelection: true } ) ), 'after operations' ).to.equal( modelAfter );
+			assertEqualMarkup( getModelData( model, { withoutSelection: true } ), modelAfter );
 
 
 			editor.execute( 'undo' );
 			editor.execute( 'undo' );
 
 
-			expect( formatTable( getModelData( model, { withoutSelection: true } ) ), 'after undo' ).to.equal( modelAfterUndo );
+			assertEqualMarkup( getModelData( model, { withoutSelection: true } ), modelAfterUndo );
 
 
 			editor.execute( 'redo' );
 			editor.execute( 'redo' );
 
 
-			expect( formatTable( getModelData( model, { withoutSelection: true } ) ), 'after redo' ).to.equal( modelAfter );
+			assertEqualMarkup( getModelData( model, { withoutSelection: true } ), modelAfter );
 		}
 		}
 
 
 		function _removeColumn( writer, columnIndex, rows ) {
 		function _removeColumn( writer, columnIndex, rows ) {

+ 3 - 2
packages/ckeditor5-table/tests/converters/upcasttable.js

@@ -9,8 +9,9 @@ import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
 import ImageEditing from '@ckeditor/ckeditor5-image/src/image/imageediting';
 import ImageEditing from '@ckeditor/ckeditor5-image/src/image/imageediting';
 import Widget from '@ckeditor/ckeditor5-widget/src/widget';
 import Widget from '@ckeditor/ckeditor5-widget/src/widget';
 
 
-import { formatTable, modelTable } from '../_utils/utils';
+import { modelTable } from '../_utils/utils';
 import TableEditing from '../../src/tableediting';
 import TableEditing from '../../src/tableediting';
+import { assertEqualMarkup } from '@ckeditor/ckeditor5-utils/tests/_utils/utils';
 
 
 describe( 'upcastTable()', () => {
 describe( 'upcastTable()', () => {
 	let editor, model;
 	let editor, model;
@@ -31,7 +32,7 @@ describe( 'upcastTable()', () => {
 	} );
 	} );
 
 
 	function expectModel( data ) {
 	function expectModel( data ) {
-		expect( formatTable( getModelData( model, { withoutSelection: true } ) ) ).to.equal( formatTable( data ) );
+		assertEqualMarkup( getModelData( model, { withoutSelection: true } ), data );
 	}
 	}
 
 
 	it( 'should convert table figure', () => {
 	it( 'should convert table figure', () => {

+ 7 - 6
packages/ckeditor5-table/tests/table-integration.js

@@ -19,7 +19,8 @@ import {
 import { parse as parseView } from '@ckeditor/ckeditor5-engine/src/dev-utils/view';
 import { parse as parseView } from '@ckeditor/ckeditor5-engine/src/dev-utils/view';
 
 
 import TableEditing from '../src/tableediting';
 import TableEditing from '../src/tableediting';
-import { formatTable, formattedModelTable, modelTable, viewTable } from './_utils/utils';
+import { modelTable, viewTable } from './_utils/utils';
+import { assertEqualMarkup } from '@ckeditor/ckeditor5-utils/tests/_utils/utils';
 
 
 describe( 'Table feature – integration', () => {
 describe( 'Table feature – integration', () => {
 	describe( 'with clipboard', () => {
 	describe( 'with clipboard', () => {
@@ -41,7 +42,7 @@ describe( 'Table feature – integration', () => {
 				content: parseView( '<td>bar</td>' )
 				content: parseView( '<td>bar</td>' )
 			} );
 			} );
 
 
-			expect( formatTable( getModelData( editor.model ) ) ).to.equal( formattedModelTable( [
+			assertEqualMarkup( getModelData( editor.model ), modelTable( [
 				[ 'foobar[]' ]
 				[ 'foobar[]' ]
 			] ) );
 			] ) );
 		} );
 		} );
@@ -53,7 +54,7 @@ describe( 'Table feature – integration', () => {
 				content: parseView( '<td>bar</td>' )
 				content: parseView( '<td>bar</td>' )
 			} );
 			} );
 
 
-			expect( formatTable( getModelData( editor.model ) ) ).to.equal( '<paragraph>foobar[]</paragraph>' );
+			assertEqualMarkup( getModelData( editor.model ), '<paragraph>foobar[]</paragraph>' );
 		} );
 		} );
 
 
 		it( 'pastes list into the td', () => {
 		it( 'pastes list into the td', () => {
@@ -63,7 +64,7 @@ describe( 'Table feature – integration', () => {
 				content: parseView( '<li>bar</li>' )
 				content: parseView( '<li>bar</li>' )
 			} );
 			} );
 
 
-			expect( formatTable( getModelData( editor.model ) ) ).to.equal( formattedModelTable( [
+			assertEqualMarkup( getModelData( editor.model ), modelTable( [
 				[ '<listItem listIndent="0" listType="bulleted">bar[]</listItem>' ]
 				[ '<listItem listIndent="0" listType="bulleted">bar[]</listItem>' ]
 			] ) );
 			] ) );
 		} );
 		} );
@@ -75,7 +76,7 @@ describe( 'Table feature – integration', () => {
 				content: parseView( '<blockquote>bar</blockquote>' )
 				content: parseView( '<blockquote>bar</blockquote>' )
 			} );
 			} );
 
 
-			expect( formatTable( getModelData( editor.model ) ) ).to.equal( formattedModelTable( [
+			assertEqualMarkup( getModelData( editor.model ), modelTable( [
 				[ '<blockQuote><paragraph>bar[]</paragraph></blockQuote>' ]
 				[ '<blockQuote><paragraph>bar[]</paragraph></blockQuote>' ]
 			] ) );
 			] ) );
 		} );
 		} );
@@ -168,7 +169,7 @@ describe( 'Table feature – integration', () => {
 
 
 			editor.execute( 'delete' );
 			editor.execute( 'delete' );
 
 
-			expect( formatTable( getModelData( editor.model ) ) ).to.equal( formattedModelTable( [
+			assertEqualMarkup( getModelData( editor.model ), modelTable( [
 				[ '<blockQuote><paragraph>Foo[]Bar</paragraph></blockQuote>' ]
 				[ '<blockQuote><paragraph>Foo[]Bar</paragraph></blockQuote>' ]
 			] ) );
 			] ) );
 		} );
 		} );

+ 29 - 28
packages/ckeditor5-table/tests/tableediting.js

@@ -10,7 +10,7 @@ import { getCode } from '@ckeditor/ckeditor5-utils/src/keyboard';
 import ImageEditing from '@ckeditor/ckeditor5-image/src/image/imageediting';
 import ImageEditing from '@ckeditor/ckeditor5-image/src/image/imageediting';
 
 
 import TableEditing from '../src/tableediting';
 import TableEditing from '../src/tableediting';
-import { formatTable, formattedModelTable, modelTable } from './_utils/utils';
+import { modelTable } from './_utils/utils';
 import InsertRowCommand from '../src/commands/insertrowcommand';
 import InsertRowCommand from '../src/commands/insertrowcommand';
 import InsertTableCommand from '../src/commands/inserttablecommand';
 import InsertTableCommand from '../src/commands/inserttablecommand';
 import InsertColumnCommand from '../src/commands/insertcolumncommand';
 import InsertColumnCommand from '../src/commands/insertcolumncommand';
@@ -21,6 +21,7 @@ import MergeCellCommand from '../src/commands/mergecellcommand';
 import SetHeaderRowCommand from '../src/commands/setheaderrowcommand';
 import SetHeaderRowCommand from '../src/commands/setheaderrowcommand';
 import SetHeaderColumnCommand from '../src/commands/setheadercolumncommand';
 import SetHeaderColumnCommand from '../src/commands/setheadercolumncommand';
 import MediaEmbedEditing from '@ckeditor/ckeditor5-media-embed/src/mediaembedediting';
 import MediaEmbedEditing from '@ckeditor/ckeditor5-media-embed/src/mediaembedediting';
+import { assertEqualMarkup } from '@ckeditor/ckeditor5-utils/tests/_utils/utils';
 
 
 describe( 'TableEditing', () => {
 describe( 'TableEditing', () => {
 	let editor, model;
 	let editor, model;
@@ -235,7 +236,7 @@ describe( 'TableEditing', () => {
 
 
 			sinon.assert.notCalled( domEvtDataStub.preventDefault );
 			sinon.assert.notCalled( domEvtDataStub.preventDefault );
 			sinon.assert.notCalled( domEvtDataStub.stopPropagation );
 			sinon.assert.notCalled( domEvtDataStub.stopPropagation );
-			expect( formatTable( getModelData( model ) ) ).to.equal( formattedModelTable( [
+			assertEqualMarkup( getModelData( model ), modelTable( [
 				[ '11', '12[]' ]
 				[ '11', '12[]' ]
 			] ) );
 			] ) );
 		} );
 		} );
@@ -251,7 +252,7 @@ describe( 'TableEditing', () => {
 
 
 			sinon.assert.notCalled( domEvtDataStub.preventDefault );
 			sinon.assert.notCalled( domEvtDataStub.preventDefault );
 			sinon.assert.notCalled( domEvtDataStub.stopPropagation );
 			sinon.assert.notCalled( domEvtDataStub.stopPropagation );
-			expect( formatTable( getModelData( model ) ) ).to.equal( formattedModelTable( [
+			assertEqualMarkup( getModelData( model ), modelTable( [
 				[ '11', '12[]' ]
 				[ '11', '12[]' ]
 			] ) );
 			] ) );
 		} );
 		} );
@@ -266,7 +267,7 @@ describe( 'TableEditing', () => {
 
 
 				sinon.assert.notCalled( domEvtDataStub.preventDefault );
 				sinon.assert.notCalled( domEvtDataStub.preventDefault );
 				sinon.assert.notCalled( domEvtDataStub.stopPropagation );
 				sinon.assert.notCalled( domEvtDataStub.stopPropagation );
-				expect( formatTable( getModelData( model ) ) ).to.equal( '[]' + formattedModelTable( [
+				assertEqualMarkup( getModelData( model ), '[]' + modelTable( [
 					[ '11', '12' ]
 					[ '11', '12' ]
 				] ) );
 				] ) );
 			} );
 			} );
@@ -280,7 +281,7 @@ describe( 'TableEditing', () => {
 
 
 				sinon.assert.calledOnce( domEvtDataStub.preventDefault );
 				sinon.assert.calledOnce( domEvtDataStub.preventDefault );
 				sinon.assert.calledOnce( domEvtDataStub.stopPropagation );
 				sinon.assert.calledOnce( domEvtDataStub.stopPropagation );
-				expect( formatTable( getModelData( model ) ) ).to.equal( formattedModelTable( [
+				assertEqualMarkup( getModelData( model ), modelTable( [
 					[ '11', '[12]' ]
 					[ '11', '[12]' ]
 				] ) );
 				] ) );
 			} );
 			} );
@@ -292,7 +293,7 @@ describe( 'TableEditing', () => {
 
 
 				editor.editing.view.document.fire( 'keydown', domEvtDataStub );
 				editor.editing.view.document.fire( 'keydown', domEvtDataStub );
 
 
-				expect( formatTable( getModelData( model ) ) ).to.equal( formattedModelTable( [
+				assertEqualMarkup( getModelData( model ), modelTable( [
 					[ '11', '12' ],
 					[ '11', '12' ],
 					[ '[]', '' ]
 					[ '[]', '' ]
 				] ) );
 				] ) );
@@ -309,7 +310,7 @@ describe( 'TableEditing', () => {
 
 
 				editor.editing.view.document.fire( 'keydown', domEvtDataStub );
 				editor.editing.view.document.fire( 'keydown', domEvtDataStub );
 
 
-				expect( formatTable( getModelData( model ) ) ).to.equal( formattedModelTable( [
+				assertEqualMarkup( getModelData( model ), modelTable( [
 					[ '11', '12[]' ]
 					[ '11', '12[]' ]
 				] ) );
 				] ) );
 			} );
 			} );
@@ -322,7 +323,7 @@ describe( 'TableEditing', () => {
 
 
 				editor.editing.view.document.fire( 'keydown', domEvtDataStub );
 				editor.editing.view.document.fire( 'keydown', domEvtDataStub );
 
 
-				expect( formatTable( getModelData( model ) ) ).to.equal( formattedModelTable( [
+				assertEqualMarkup( getModelData( model ), modelTable( [
 					[ '11', '12' ],
 					[ '11', '12' ],
 					[ '[21]', '22' ]
 					[ '[21]', '22' ]
 				] ) );
 				] ) );
@@ -330,17 +331,17 @@ describe( 'TableEditing', () => {
 
 
 			it( 'should move to the next table cell if part of block content is selected', () => {
 			it( 'should move to the next table cell if part of block content is selected', () => {
 				setModelData( model, modelTable( [
 				setModelData( model, modelTable( [
-					[ '11', '<paragraph>12</paragraph><paragraph>[foo]</paragraph><paragraph>bar</paragraph>', '13' ],
+					[ '11', '<paragraph>12</paragraph><paragraph>[foo]</paragraph><paragraph>bar</paragraph>', '13' ]
 				] ) );
 				] ) );
 
 
 				editor.editing.view.document.fire( 'keydown', domEvtDataStub );
 				editor.editing.view.document.fire( 'keydown', domEvtDataStub );
 
 
-				expect( formatTable( getModelData( model ) ) ).to.equal( formattedModelTable( [
+				assertEqualMarkup( getModelData( model ), modelTable( [
 					[
 					[
 						'11',
 						'11',
 						'<paragraph>12</paragraph><paragraph>foo</paragraph><paragraph>bar</paragraph>',
 						'<paragraph>12</paragraph><paragraph>foo</paragraph><paragraph>bar</paragraph>',
 						'[13]'
 						'[13]'
-					],
+					]
 				] ) );
 				] ) );
 			} );
 			} );
 
 
@@ -353,7 +354,7 @@ describe( 'TableEditing', () => {
 
 
 				sinon.assert.calledOnce( domEvtDataStub.preventDefault );
 				sinon.assert.calledOnce( domEvtDataStub.preventDefault );
 				sinon.assert.calledOnce( domEvtDataStub.stopPropagation );
 				sinon.assert.calledOnce( domEvtDataStub.stopPropagation );
-				expect( formatTable( getModelData( model ) ) ).to.equal( formattedModelTable( [
+				assertEqualMarkup( getModelData( model ), modelTable( [
 					[ '11', '<paragraph>[foo</paragraph><image></image>]' ]
 					[ '11', '<paragraph>[foo</paragraph><image></image>]' ]
 				] ) );
 				] ) );
 			} );
 			} );
@@ -373,7 +374,7 @@ describe( 'TableEditing', () => {
 
 
 				sinon.assert.calledOnce( domEvtDataStub.preventDefault );
 				sinon.assert.calledOnce( domEvtDataStub.preventDefault );
 				sinon.assert.calledOnce( domEvtDataStub.stopPropagation );
 				sinon.assert.calledOnce( domEvtDataStub.stopPropagation );
-				expect( formatTable( getModelData( model ) ) ).to.equal( formattedModelTable( [
+				assertEqualMarkup( getModelData( model ), modelTable( [
 					[ '11', '<blockQuote><paragraph>[foo]</paragraph></blockQuote>' ]
 					[ '11', '<blockQuote><paragraph>[foo]</paragraph></blockQuote>' ]
 				] ) );
 				] ) );
 			} );
 			} );
@@ -391,7 +392,7 @@ describe( 'TableEditing', () => {
 				sinon.assert.calledOnce( domEvtDataStub.preventDefault );
 				sinon.assert.calledOnce( domEvtDataStub.preventDefault );
 				sinon.assert.calledOnce( domEvtDataStub.stopPropagation );
 				sinon.assert.calledOnce( domEvtDataStub.stopPropagation );
 
 
-				expect( formatTable( getModelData( model ) ) ).to.equal( formattedModelTable( [
+				assertEqualMarkup( getModelData( model ), modelTable( [
 					[ '11[]', '12' ]
 					[ '11[]', '12' ]
 				] ) );
 				] ) );
 			} );
 			} );
@@ -421,7 +422,7 @@ describe( 'TableEditing', () => {
 					sinon.assert.calledOnce( domEvtDataStub.preventDefault );
 					sinon.assert.calledOnce( domEvtDataStub.preventDefault );
 					sinon.assert.calledOnce( domEvtDataStub.stopPropagation );
 					sinon.assert.calledOnce( domEvtDataStub.stopPropagation );
 
 
-					expect( formatTable( getModelData( model ) ) ).to.equal( formattedModelTable( [
+					assertEqualMarkup( getModelData( model ), modelTable( [
 						[ '[11]', '12' ]
 						[ '[11]', '12' ]
 					] ) );
 					] ) );
 
 
@@ -441,7 +442,7 @@ describe( 'TableEditing', () => {
 					sinon.assert.notCalled( domEvtDataStub.preventDefault );
 					sinon.assert.notCalled( domEvtDataStub.preventDefault );
 					sinon.assert.notCalled( domEvtDataStub.stopPropagation );
 					sinon.assert.notCalled( domEvtDataStub.stopPropagation );
 
 
-					expect( formatTable( getModelData( model ) ) ).to.equal( '[<block>foo</block>]' );
+					assertEqualMarkup( getModelData( model ), '[<block>foo</block>]' );
 
 
 					// Should not cancel event.
 					// Should not cancel event.
 					sinon.assert.calledOnce( spy );
 					sinon.assert.calledOnce( spy );
@@ -466,7 +467,7 @@ describe( 'TableEditing', () => {
 
 
 				sinon.assert.notCalled( domEvtDataStub.preventDefault );
 				sinon.assert.notCalled( domEvtDataStub.preventDefault );
 				sinon.assert.notCalled( domEvtDataStub.stopPropagation );
 				sinon.assert.notCalled( domEvtDataStub.stopPropagation );
-				expect( formatTable( getModelData( model ) ) ).to.equal( '[]' + formattedModelTable( [
+				assertEqualMarkup( getModelData( model ), '[]' + modelTable( [
 					[ '11', '12' ]
 					[ '11', '12' ]
 				] ) );
 				] ) );
 			} );
 			} );
@@ -481,7 +482,7 @@ describe( 'TableEditing', () => {
 				sinon.assert.calledOnce( domEvtDataStub.preventDefault );
 				sinon.assert.calledOnce( domEvtDataStub.preventDefault );
 				sinon.assert.calledOnce( domEvtDataStub.stopPropagation );
 				sinon.assert.calledOnce( domEvtDataStub.stopPropagation );
 
 
-				expect( formatTable( getModelData( model ) ) ).to.equal( formattedModelTable( [
+				assertEqualMarkup( getModelData( model ), modelTable( [
 					[ '[11]', '12' ]
 					[ '[11]', '12' ]
 				] ) );
 				] ) );
 			} );
 			} );
@@ -493,8 +494,8 @@ describe( 'TableEditing', () => {
 
 
 				editor.editing.view.document.fire( 'keydown', domEvtDataStub );
 				editor.editing.view.document.fire( 'keydown', domEvtDataStub );
 
 
-				expect( formatTable( getModelData( model ) ) ).to.equal(
-					'<paragraph>foo</paragraph>' + formattedModelTable( [ [ '[]11', '12' ] ] )
+				assertEqualMarkup( getModelData( model ),
+					'<paragraph>foo</paragraph>' + modelTable( [ [ '[]11', '12' ] ] )
 				);
 				);
 			} );
 			} );
 
 
@@ -506,7 +507,7 @@ describe( 'TableEditing', () => {
 
 
 				editor.editing.view.document.fire( 'keydown', domEvtDataStub );
 				editor.editing.view.document.fire( 'keydown', domEvtDataStub );
 
 
-				expect( formatTable( getModelData( model ) ) ).to.equal( formattedModelTable( [
+				assertEqualMarkup( getModelData( model ), modelTable( [
 					[ '11', '[12]' ],
 					[ '11', '[12]' ],
 					[ '21', '22' ]
 					[ '21', '22' ]
 				] ) );
 				] ) );
@@ -514,17 +515,17 @@ describe( 'TableEditing', () => {
 
 
 			it( 'should move to the previous table cell if part of block content is selected', () => {
 			it( 'should move to the previous table cell if part of block content is selected', () => {
 				setModelData( model, modelTable( [
 				setModelData( model, modelTable( [
-					[ '11', '<paragraph>12</paragraph><paragraph>[foo]</paragraph><paragraph>bar</paragraph>', '13' ],
+					[ '11', '<paragraph>12</paragraph><paragraph>[foo]</paragraph><paragraph>bar</paragraph>', '13' ]
 				] ) );
 				] ) );
 
 
 				editor.editing.view.document.fire( 'keydown', domEvtDataStub );
 				editor.editing.view.document.fire( 'keydown', domEvtDataStub );
 
 
-				expect( formatTable( getModelData( model ) ) ).to.equal( formattedModelTable( [
+				assertEqualMarkup( getModelData( model ), modelTable( [
 					[
 					[
 						'[11]',
 						'[11]',
 						'<paragraph>12</paragraph><paragraph>foo</paragraph><paragraph>bar</paragraph>',
 						'<paragraph>12</paragraph><paragraph>foo</paragraph><paragraph>bar</paragraph>',
 						'13'
 						'13'
-					],
+					]
 				] ) );
 				] ) );
 			} );
 			} );
 
 
@@ -537,7 +538,7 @@ describe( 'TableEditing', () => {
 
 
 				sinon.assert.calledOnce( domEvtDataStub.preventDefault );
 				sinon.assert.calledOnce( domEvtDataStub.preventDefault );
 				sinon.assert.calledOnce( domEvtDataStub.stopPropagation );
 				sinon.assert.calledOnce( domEvtDataStub.stopPropagation );
-				expect( formatTable( getModelData( model ) ) ).to.equal( formattedModelTable( [
+				assertEqualMarkup( getModelData( model ), modelTable( [
 					[ '<paragraph>[foo</paragraph><image></image>]', 'bar' ]
 					[ '<paragraph>[foo</paragraph><image></image>]', 'bar' ]
 				] ) );
 				] ) );
 			} );
 			} );
@@ -574,7 +575,7 @@ describe( 'TableEditing', () => {
 			viewDocument.fire( 'enter', evtDataStub );
 			viewDocument.fire( 'enter', evtDataStub );
 
 
 			sinon.assert.notCalled( editor.execute );
 			sinon.assert.notCalled( editor.execute );
-			expect( formatTable( getModelData( model ) ) ).to.equal( '<paragraph>[]foo</paragraph>' );
+			assertEqualMarkup( getModelData( model ), '<paragraph>[]foo</paragraph>' );
 		} );
 		} );
 
 
 		it( 'should do nothing if table cell has already a block content', () => {
 		it( 'should do nothing if table cell has already a block content', () => {
@@ -585,7 +586,7 @@ describe( 'TableEditing', () => {
 			viewDocument.fire( 'enter', evtDataStub );
 			viewDocument.fire( 'enter', evtDataStub );
 
 
 			sinon.assert.notCalled( editor.execute );
 			sinon.assert.notCalled( editor.execute );
-			expect( formatTable( getModelData( model ) ) ).to.equal( formattedModelTable( [
+			assertEqualMarkup( getModelData( model ), modelTable( [
 				[ '<paragraph>[]11</paragraph>' ]
 				[ '<paragraph>[]11</paragraph>' ]
 			] ) );
 			] ) );
 		} );
 		} );
@@ -612,7 +613,7 @@ describe( 'TableEditing', () => {
 			viewDocument.fire( 'enter', evtDataStub );
 			viewDocument.fire( 'enter', evtDataStub );
 
 
 			sinon.assert.notCalled( editor.execute );
 			sinon.assert.notCalled( editor.execute );
-			expect( formatTable( getModelData( model ) ) ).to.equal( formattedModelTable( [
+			assertEqualMarkup( getModelData( model ), modelTable( [
 				[ '[]11' ]
 				[ '[]11' ]
 			] ) );
 			] ) );
 		} );
 		} );

+ 39 - 38
packages/ckeditor5-table/tests/tableutils.js

@@ -6,9 +6,10 @@
 import ModelTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/modeltesteditor';
 import ModelTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/modeltesteditor';
 import { getData, setData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model';
 import { getData, setData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model';
 
 
-import { defaultConversion, defaultSchema, formatTable, formattedModelTable, modelTable } from './_utils/utils';
+import { defaultConversion, defaultSchema, modelTable } from './_utils/utils';
 
 
 import TableUtils from '../src/tableutils';
 import TableUtils from '../src/tableutils';
+import { assertEqualMarkup } from '@ckeditor/ckeditor5-utils/tests/_utils/utils';
 
 
 describe( 'TableUtils', () => {
 describe( 'TableUtils', () => {
 	let editor, model, root, tableUtils;
 	let editor, model, root, tableUtils;
@@ -59,7 +60,7 @@ describe( 'TableUtils', () => {
 
 
 			tableUtils.insertRows( root.getNodeByPath( [ 0 ] ), { at: 1 } );
 			tableUtils.insertRows( root.getNodeByPath( [ 0 ] ), { at: 1 } );
 
 
-			expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+			assertEqualMarkup( getData( model ), modelTable( [
 				[ '11[]', '12' ],
 				[ '11[]', '12' ],
 				[ '', '' ],
 				[ '', '' ],
 				[ '21', '22' ]
 				[ '21', '22' ]
@@ -74,7 +75,7 @@ describe( 'TableUtils', () => {
 
 
 			tableUtils.insertRows( root.getNodeByPath( [ 0 ] ) );
 			tableUtils.insertRows( root.getNodeByPath( [ 0 ] ) );
 
 
-			expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+			assertEqualMarkup( getData( model ), modelTable( [
 				[ '', '' ],
 				[ '', '' ],
 				[ '11[]', '12' ],
 				[ '11[]', '12' ],
 				[ '21', '22' ]
 				[ '21', '22' ]
@@ -90,7 +91,7 @@ describe( 'TableUtils', () => {
 
 
 			tableUtils.insertRows( root.getNodeByPath( [ 0 ] ), { at: 1 } );
 			tableUtils.insertRows( root.getNodeByPath( [ 0 ] ), { at: 1 } );
 
 
-			expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+			assertEqualMarkup( getData( model ), modelTable( [
 				[ '11[]', '12' ],
 				[ '11[]', '12' ],
 				[ '', '' ],
 				[ '', '' ],
 				[ '21', '22' ],
 				[ '21', '22' ],
@@ -107,7 +108,7 @@ describe( 'TableUtils', () => {
 
 
 			tableUtils.insertRows( root.getNodeByPath( [ 0 ] ), { at: 2 } );
 			tableUtils.insertRows( root.getNodeByPath( [ 0 ] ), { at: 2 } );
 
 
-			expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+			assertEqualMarkup( getData( model ), modelTable( [
 				[ '11[]', '12' ],
 				[ '11[]', '12' ],
 				[ '21', '22' ],
 				[ '21', '22' ],
 				[ '', '' ],
 				[ '', '' ],
@@ -124,7 +125,7 @@ describe( 'TableUtils', () => {
 
 
 			tableUtils.insertRows( root.getNodeByPath( [ 0 ] ), { at: 2, rows: 3 } );
 			tableUtils.insertRows( root.getNodeByPath( [ 0 ] ), { at: 2, rows: 3 } );
 
 
-			expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+			assertEqualMarkup( getData( model ), modelTable( [
 				[ { colspan: 2, contents: '11[]' }, '13', '14' ],
 				[ { colspan: 2, contents: '11[]' }, '13', '14' ],
 				[ { colspan: 2, rowspan: 7, contents: '21' }, '23', '24' ],
 				[ { colspan: 2, rowspan: 7, contents: '21' }, '23', '24' ],
 				[ '', '' ],
 				[ '', '' ],
@@ -143,7 +144,7 @@ describe( 'TableUtils', () => {
 
 
 			tableUtils.insertRows( root.getNodeByPath( [ 0 ] ), { at: 2, rows: 3 } );
 			tableUtils.insertRows( root.getNodeByPath( [ 0 ] ), { at: 2, rows: 3 } );
 
 
-			expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+			assertEqualMarkup( getData( model ), modelTable( [
 				[ { rowspan: 2, contents: '11[]' }, '12', '13' ],
 				[ { rowspan: 2, contents: '11[]' }, '12', '13' ],
 				[ '22', '23' ],
 				[ '22', '23' ],
 				[ '', '', '' ],
 				[ '', '', '' ],
@@ -162,7 +163,7 @@ describe( 'TableUtils', () => {
 
 
 			tableUtils.insertRows( root.getNodeByPath( [ 0 ] ), { at: 2, rows: 3 } );
 			tableUtils.insertRows( root.getNodeByPath( [ 0 ] ), { at: 2, rows: 3 } );
 
 
-			expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+			assertEqualMarkup( getData( model ), modelTable( [
 				[ { rowspan: 2, contents: '11[]' }, '12', '13' ],
 				[ { rowspan: 2, contents: '11[]' }, '12', '13' ],
 				[ '22', '23' ],
 				[ '22', '23' ],
 				[ '', '', '' ],
 				[ '', '', '' ],
@@ -180,7 +181,7 @@ describe( 'TableUtils', () => {
 
 
 			tableUtils.insertRows( root.getNodeByPath( [ 0 ] ), { at: 2, rows: 3 } );
 			tableUtils.insertRows( root.getNodeByPath( [ 0 ] ), { at: 2, rows: 3 } );
 
 
-			expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+			assertEqualMarkup( getData( model ), modelTable( [
 				[ '11[]', '12' ],
 				[ '11[]', '12' ],
 				[ '21', '22' ],
 				[ '21', '22' ],
 				[ '', '' ],
 				[ '', '' ],
@@ -199,7 +200,7 @@ describe( 'TableUtils', () => {
 
 
 			tableUtils.insertColumns( root.getNodeByPath( [ 0 ] ), { at: 1 } );
 			tableUtils.insertColumns( root.getNodeByPath( [ 0 ] ), { at: 1 } );
 
 
-			expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+			assertEqualMarkup( getData( model ), modelTable( [
 				[ '11[]', '', '12' ],
 				[ '11[]', '', '12' ],
 				[ '21', '', '22' ]
 				[ '21', '', '22' ]
 			] ) );
 			] ) );
@@ -213,7 +214,7 @@ describe( 'TableUtils', () => {
 
 
 			tableUtils.insertColumns( root.getNodeByPath( [ 0 ] ) );
 			tableUtils.insertColumns( root.getNodeByPath( [ 0 ] ) );
 
 
-			expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+			assertEqualMarkup( getData( model ), modelTable( [
 				[ '', '11[]', '12' ],
 				[ '', '11[]', '12' ],
 				[ '', '21', '22' ]
 				[ '', '21', '22' ]
 			] ) );
 			] ) );
@@ -227,7 +228,7 @@ describe( 'TableUtils', () => {
 
 
 			tableUtils.insertColumns( root.getNodeByPath( [ 0 ] ) );
 			tableUtils.insertColumns( root.getNodeByPath( [ 0 ] ) );
 
 
-			expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+			assertEqualMarkup( getData( model ), modelTable( [
 				[ '', '11[]', '12' ],
 				[ '', '11[]', '12' ],
 				[ '', '21', '22' ]
 				[ '', '21', '22' ]
 			] ) );
 			] ) );
@@ -243,7 +244,7 @@ describe( 'TableUtils', () => {
 
 
 			tableUtils.insertColumns( root.getNodeByPath( [ 0 ] ), { at: 2, columns: 2 } );
 			tableUtils.insertColumns( root.getNodeByPath( [ 0 ] ), { at: 2, columns: 2 } );
 
 
-			expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+			assertEqualMarkup( getData( model ), modelTable( [
 				[ '00[]', '01', '', '' ],
 				[ '00[]', '01', '', '' ],
 				[ { colspan: 2, contents: '10' }, '', '' ],
 				[ { colspan: 2, contents: '10' }, '', '' ],
 				[ '20', { rowspan: 2, contents: '21' }, '', '' ],
 				[ '20', { rowspan: 2, contents: '21' }, '', '' ],
@@ -262,7 +263,7 @@ describe( 'TableUtils', () => {
 
 
 			tableUtils.insertColumns( root.getNodeByPath( [ 0 ] ), { at: 0, columns: 2 } );
 			tableUtils.insertColumns( root.getNodeByPath( [ 0 ] ), { at: 0, columns: 2 } );
 
 
-			expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+			assertEqualMarkup( getData( model ), modelTable( [
 				[ '', '', '00[]', '01' ],
 				[ '', '', '00[]', '01' ],
 				[ '', '', { colspan: 2, contents: '10' } ],
 				[ '', '', { colspan: 2, contents: '10' } ],
 				[ '', '', '20', { rowspan: 2, contents: '21' } ],
 				[ '', '', '20', { rowspan: 2, contents: '21' } ],
@@ -280,7 +281,7 @@ describe( 'TableUtils', () => {
 
 
 			tableUtils.insertColumns( root.getNodeByPath( [ 0 ] ), { at: 1 } );
 			tableUtils.insertColumns( root.getNodeByPath( [ 0 ] ), { at: 1 } );
 
 
-			expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+			assertEqualMarkup( getData( model ), modelTable( [
 				[ '11[]', '', '12' ],
 				[ '11[]', '', '12' ],
 				[ '21', '', '22' ],
 				[ '21', '', '22' ],
 				[ '31', '', '32' ]
 				[ '31', '', '32' ]
@@ -296,7 +297,7 @@ describe( 'TableUtils', () => {
 
 
 			tableUtils.insertColumns( root.getNodeByPath( [ 0 ] ), { at: 2 } );
 			tableUtils.insertColumns( root.getNodeByPath( [ 0 ] ), { at: 2 } );
 
 
-			expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+			assertEqualMarkup( getData( model ), modelTable( [
 				[ '11[]', '12', '', '13' ],
 				[ '11[]', '12', '', '13' ],
 				[ '21', '22', '', '23' ],
 				[ '21', '22', '', '23' ],
 				[ '31', '32', '', '33' ]
 				[ '31', '32', '', '33' ]
@@ -312,7 +313,7 @@ describe( 'TableUtils', () => {
 
 
 			tableUtils.insertColumns( root.getNodeByPath( [ 0 ] ), { at: 1 } );
 			tableUtils.insertColumns( root.getNodeByPath( [ 0 ] ), { at: 1 } );
 
 
-			expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+			assertEqualMarkup( getData( model ), modelTable( [
 				[ '00[]', '', '01' ],
 				[ '00[]', '', '01' ],
 				[ { colspan: 3, contents: '10' } ],
 				[ { colspan: 3, contents: '10' } ],
 				[ '20', '', '21' ]
 				[ '20', '', '21' ]
@@ -328,7 +329,7 @@ describe( 'TableUtils', () => {
 
 
 			tableUtils.insertColumns( root.getNodeByPath( [ 0 ] ), { at: 2, columns: 2 } );
 			tableUtils.insertColumns( root.getNodeByPath( [ 0 ] ), { at: 2, columns: 2 } );
 
 
-			expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+			assertEqualMarkup( getData( model ), modelTable( [
 				[ '11[]', '12', '', '', '13', '14', '15' ],
 				[ '11[]', '12', '', '', '13', '14', '15' ],
 				[ '21', '22', '', '', { colspan: 2, contents: '23' }, '25' ],
 				[ '21', '22', '', '', { colspan: 2, contents: '23' }, '25' ],
 				[ { colspan: 6, contents: '31' }, { colspan: 2, contents: '34' } ]
 				[ { colspan: 6, contents: '31' }, { colspan: 2, contents: '34' } ]
@@ -344,7 +345,7 @@ describe( 'TableUtils', () => {
 
 
 			tableUtils.insertColumns( root.getNodeByPath( [ 0 ] ), { at: 1, columns: 2 } );
 			tableUtils.insertColumns( root.getNodeByPath( [ 0 ] ), { at: 1, columns: 2 } );
 
 
-			expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+			assertEqualMarkup( getData( model ), modelTable( [
 				[ { colspan: 4, rowspan: 2, contents: '00[]' }, '02' ],
 				[ { colspan: 4, rowspan: 2, contents: '00[]' }, '02' ],
 				[ '12' ],
 				[ '12' ],
 				[ '20', '', '', '21', '22' ]
 				[ '20', '', '', '21', '22' ]
@@ -361,7 +362,7 @@ describe( 'TableUtils', () => {
 
 
 			tableUtils.insertColumns( root.getNodeByPath( [ 0 ] ), { at: 1, columns: 1 } );
 			tableUtils.insertColumns( root.getNodeByPath( [ 0 ] ), { at: 1, columns: 1 } );
 
 
-			expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+			assertEqualMarkup( getData( model ), modelTable( [
 				[ { rowspan: 4, contents: '00[]' }, '', { rowspan: 2, contents: '01' }, '02' ],
 				[ { rowspan: 4, contents: '00[]' }, '', { rowspan: 2, contents: '01' }, '02' ],
 				[ '', '12' ],
 				[ '', '12' ],
 				[ '', { rowspan: 2, contents: '21' }, '22' ],
 				[ '', { rowspan: 2, contents: '21' }, '22' ],
@@ -381,7 +382,7 @@ describe( 'TableUtils', () => {
 
 
 			tableUtils.splitCellVertically( root.getNodeByPath( [ 0, 1, 1 ] ), 3 );
 			tableUtils.splitCellVertically( root.getNodeByPath( [ 0, 1, 1 ] ), 3 );
 
 
-			expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+			assertEqualMarkup( getData( model ), modelTable( [
 				[ '00', { colspan: 3, contents: '01' }, '02' ],
 				[ '00', { colspan: 3, contents: '01' }, '02' ],
 				[ '10', '[]11', '', '', '12' ],
 				[ '10', '[]11', '', '', '12' ],
 				[ '20', { colspan: 4, contents: '21' } ],
 				[ '20', { colspan: 4, contents: '21' } ],
@@ -399,7 +400,7 @@ describe( 'TableUtils', () => {
 
 
 			tableUtils.splitCellVertically( root.getNodeByPath( [ 0, 1, 1 ] ) );
 			tableUtils.splitCellVertically( root.getNodeByPath( [ 0, 1, 1 ] ) );
 
 
-			expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+			assertEqualMarkup( getData( model ), modelTable( [
 				[ '00', { colspan: 2, contents: '01' }, '02' ],
 				[ '00', { colspan: 2, contents: '01' }, '02' ],
 				[ '10', '[]11', '', '12' ],
 				[ '10', '[]11', '', '12' ],
 				[ '20', { colspan: 3, contents: '21' } ],
 				[ '20', { colspan: 3, contents: '21' } ],
@@ -417,7 +418,7 @@ describe( 'TableUtils', () => {
 
 
 			tableUtils.splitCellVertically( root.getNodeByPath( [ 0, 2, 1 ] ), 2 );
 			tableUtils.splitCellVertically( root.getNodeByPath( [ 0, 2, 1 ] ), 2 );
 
 
-			expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+			assertEqualMarkup( getData( model ), modelTable( [
 				[ '00', '01', '02' ],
 				[ '00', '01', '02' ],
 				[ '10', '11', '12' ],
 				[ '10', '11', '12' ],
 				[ '20', '21[]', '' ],
 				[ '20', '21[]', '' ],
@@ -433,7 +434,7 @@ describe( 'TableUtils', () => {
 
 
 			tableUtils.splitCellVertically( root.getNodeByPath( [ 0, 1, 0 ] ), 2 );
 			tableUtils.splitCellVertically( root.getNodeByPath( [ 0, 1, 0 ] ), 2 );
 
 
-			expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+			assertEqualMarkup( getData( model ), modelTable( [
 				[ '00', '01', '02' ],
 				[ '00', '01', '02' ],
 				[ { colspan: 2, contents: '10[]' }, '' ]
 				[ { colspan: 2, contents: '10[]' }, '' ]
 			] ) );
 			] ) );
@@ -447,7 +448,7 @@ describe( 'TableUtils', () => {
 
 
 			tableUtils.splitCellVertically( root.getNodeByPath( [ 0, 1, 0 ] ), 2 );
 			tableUtils.splitCellVertically( root.getNodeByPath( [ 0, 1, 0 ] ), 2 );
 
 
-			expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+			assertEqualMarkup( getData( model ), modelTable( [
 				[ '00', '01', '02', '03' ],
 				[ '00', '01', '02', '03' ],
 				[ { colspan: 2, contents: '10[]' }, { colspan: 2, contents: '' } ]
 				[ { colspan: 2, contents: '10[]' }, { colspan: 2, contents: '' } ]
 			] ) );
 			] ) );
@@ -462,7 +463,7 @@ describe( 'TableUtils', () => {
 
 
 			tableUtils.splitCellVertically( root.getNodeByPath( [ 0, 1, 0 ] ), 2 );
 			tableUtils.splitCellVertically( root.getNodeByPath( [ 0, 1, 0 ] ), 2 );
 
 
-			expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+			assertEqualMarkup( getData( model ), modelTable( [
 				[ '00', '01', '02', '03', '04', '05' ],
 				[ '00', '01', '02', '03', '04', '05' ],
 				[ { colspan: 3, rowspan: 2, contents: '10[]' }, { colspan: 2, rowspan: 2, contents: '' }, '15' ],
 				[ { colspan: 3, rowspan: 2, contents: '10[]' }, { colspan: 2, rowspan: 2, contents: '' }, '15' ],
 				[ '25' ]
 				[ '25' ]
@@ -478,7 +479,7 @@ describe( 'TableUtils', () => {
 
 
 			tableUtils.splitCellVertically( root.getNodeByPath( [ 0, 1, 0 ] ), 3 );
 			tableUtils.splitCellVertically( root.getNodeByPath( [ 0, 1, 0 ] ), 3 );
 
 
-			expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+			assertEqualMarkup( getData( model ), modelTable( [
 				[ { colspan: 2, contents: '00' }, '01', '02' ],
 				[ { colspan: 2, contents: '00' }, '01', '02' ],
 				[ { rowspan: 2, contents: '10[]' }, { rowspan: 2, contents: '' }, { rowspan: 2, contents: '' }, '12' ],
 				[ { rowspan: 2, contents: '10[]' }, { rowspan: 2, contents: '' }, { rowspan: 2, contents: '' }, '12' ],
 				[ '22' ]
 				[ '22' ]
@@ -493,7 +494,7 @@ describe( 'TableUtils', () => {
 
 
 			tableUtils.splitCellVertically( root.getNodeByPath( [ 0, 1, 0 ] ), 6 );
 			tableUtils.splitCellVertically( root.getNodeByPath( [ 0, 1, 0 ] ), 6 );
 
 
-			expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+			assertEqualMarkup( getData( model ), modelTable( [
 				[ { colspan: 3, contents: '00' }, '01', '02', '03' ],
 				[ { colspan: 3, contents: '00' }, '01', '02', '03' ],
 				[ '10[]', '', '', '', '', '' ]
 				[ '10[]', '', '', '', '', '' ]
 			] ) );
 			] ) );
@@ -507,7 +508,7 @@ describe( 'TableUtils', () => {
 
 
 			tableUtils.splitCellVertically( root.getNodeByPath( [ 0, 1, 0 ] ), 3 );
 			tableUtils.splitCellVertically( root.getNodeByPath( [ 0, 1, 0 ] ), 3 );
 
 
-			expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+			assertEqualMarkup( getData( model ), modelTable( [
 				[ { colspan: 3, contents: '00' }, '01' ],
 				[ { colspan: 3, contents: '00' }, '01' ],
 				[ '10[]', '', '', '11' ]
 				[ '10[]', '', '', '11' ]
 			], { headingColumns: 3 } ) );
 			], { headingColumns: 3 } ) );
@@ -524,7 +525,7 @@ describe( 'TableUtils', () => {
 
 
 			tableUtils.splitCellHorizontally( root.getNodeByPath( [ 0, 1, 1 ] ) );
 			tableUtils.splitCellHorizontally( root.getNodeByPath( [ 0, 1, 1 ] ) );
 
 
-			expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+			assertEqualMarkup( getData( model ), modelTable( [
 				[ '00', '01', '02' ],
 				[ '00', '01', '02' ],
 				[ { rowspan: 2, contents: '10' }, '[]11', { rowspan: 2, contents: '12' } ],
 				[ { rowspan: 2, contents: '10' }, '[]11', { rowspan: 2, contents: '12' } ],
 				[ '' ],
 				[ '' ],
@@ -541,7 +542,7 @@ describe( 'TableUtils', () => {
 
 
 			tableUtils.splitCellHorizontally( root.getNodeByPath( [ 0, 1, 1 ] ), 4 );
 			tableUtils.splitCellHorizontally( root.getNodeByPath( [ 0, 1, 1 ] ), 4 );
 
 
-			expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+			assertEqualMarkup( getData( model ), modelTable( [
 				[ '00', '01', '02' ],
 				[ '00', '01', '02' ],
 				[ { rowspan: 4, contents: '10' }, '[]11', { rowspan: 4, contents: '12' } ],
 				[ { rowspan: 4, contents: '10' }, '[]11', { rowspan: 4, contents: '12' } ],
 				[ '' ],
 				[ '' ],
@@ -560,7 +561,7 @@ describe( 'TableUtils', () => {
 
 
 			tableUtils.splitCellHorizontally( root.getNodeByPath( [ 0, 1, 0 ] ), 3 );
 			tableUtils.splitCellHorizontally( root.getNodeByPath( [ 0, 1, 0 ] ), 3 );
 
 
-			expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+			assertEqualMarkup( getData( model ), modelTable( [
 				[ { rowspan: 4, contents: '00' }, '01', { rowspan: 5, contents: '02' } ],
 				[ { rowspan: 4, contents: '00' }, '01', { rowspan: 5, contents: '02' } ],
 				[ '[]11' ],
 				[ '[]11' ],
 				[ '' ],
 				[ '' ],
@@ -580,7 +581,7 @@ describe( 'TableUtils', () => {
 
 
 			tableUtils.splitCellHorizontally( tableCell, 2 );
 			tableUtils.splitCellHorizontally( tableCell, 2 );
 
 
-			expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+			assertEqualMarkup( getData( model ), modelTable( [
 				[ '00', '01[]' ],
 				[ '00', '01[]' ],
 				[ '10', '' ],
 				[ '10', '' ],
 				[ '20', '21' ]
 				[ '20', '21' ]
@@ -598,7 +599,7 @@ describe( 'TableUtils', () => {
 
 
 			tableUtils.splitCellHorizontally( tableCell, 2 );
 			tableUtils.splitCellHorizontally( tableCell, 2 );
 
 
-			expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+			assertEqualMarkup( getData( model ), modelTable( [
 				[ '00', { colspan: 2, contents: '01[]' } ],
 				[ '00', { colspan: 2, contents: '01[]' } ],
 				[ '10', { colspan: 2, contents: '' } ],
 				[ '10', { colspan: 2, contents: '' } ],
 				[ '20', '21', '22' ]
 				[ '20', '21', '22' ]
@@ -621,7 +622,7 @@ describe( 'TableUtils', () => {
 
 
 			tableUtils.splitCellHorizontally( tableCell, 3 );
 			tableUtils.splitCellHorizontally( tableCell, 3 );
 
 
-			expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+			assertEqualMarkup( getData( model ), modelTable( [
 				[ '00', { rowspan: 3, contents: '01[]' } ],
 				[ '00', { rowspan: 3, contents: '01[]' } ],
 				[ '10' ],
 				[ '10' ],
 				[ '20' ],
 				[ '20' ],
@@ -644,7 +645,7 @@ describe( 'TableUtils', () => {
 
 
 			tableUtils.splitCellHorizontally( tableCell, 3 );
 			tableUtils.splitCellHorizontally( tableCell, 3 );
 
 
-			expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+			assertEqualMarkup( getData( model ), modelTable( [
 				[ { rowspan: 2, contents: '00' }, '01[]' ],
 				[ { rowspan: 2, contents: '00' }, '01[]' ],
 				[ '' ],
 				[ '' ],
 				[ '10', '' ],
 				[ '10', '' ],
@@ -662,7 +663,7 @@ describe( 'TableUtils', () => {
 
 
 			tableUtils.splitCellHorizontally( tableCell, 3 );
 			tableUtils.splitCellHorizontally( tableCell, 3 );
 
 
-			expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+			assertEqualMarkup( getData( model ), modelTable( [
 				[ { rowspan: 3, contents: '00' }, { colspan: 2, contents: '01[]' } ],
 				[ { rowspan: 3, contents: '00' }, { colspan: 2, contents: '01[]' } ],
 				[ { colspan: 2, contents: '' } ],
 				[ { colspan: 2, contents: '' } ],
 				[ { colspan: 2, contents: '' } ],
 				[ { colspan: 2, contents: '' } ],
@@ -679,7 +680,7 @@ describe( 'TableUtils', () => {
 
 
 			tableUtils.splitCellHorizontally( root.getNodeByPath( [ 0, 0, 0 ] ), 3 );
 			tableUtils.splitCellHorizontally( root.getNodeByPath( [ 0, 0, 0 ] ), 3 );
 
 
-			expect( formatTable( getData( model ) ) ).to.equal( formattedModelTable( [
+			assertEqualMarkup( getData( model ), modelTable( [
 				[ '00[]', { rowspan: 3, contents: '01' }, { rowspan: 3, contents: '02' } ],
 				[ '00[]', { rowspan: 3, contents: '01' }, { rowspan: 3, contents: '02' } ],
 				[ '' ],
 				[ '' ],
 				[ '' ],
 				[ '' ],