Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
Move test code around.
Browse files Browse the repository at this point in the history
  • Loading branch information
jodator committed Jan 28, 2020
1 parent 3ca0d10 commit dcb7e6f
Showing 1 changed file with 38 additions and 38 deletions.
76 changes: 38 additions & 38 deletions tests/model/utils/selection-post-fixer.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ describe( 'Selection post-fixer', () => {
expect( getModelData( model ) ).to.equal( '<paragraph>foo[]</paragraph><image></image>' );
} );

describe( 'non-collapsed selection - table scenarios', () => {
describe( 'selection - table scenarios', () => {
beforeEach( () => {
setModelData( model,
'<paragraph>[]foo</paragraph>' +
Expand Down Expand Up @@ -198,6 +198,43 @@ describe( 'Selection post-fixer', () => {
);
} );

it( 'should fix #5 - collapsed selection between tables', () => {
setModelData( model,
'<paragraph>foo</paragraph>' +
'<table>' +
'<tableRow>' +
'<tableCell><paragraph>aaa</paragraph></tableCell>' +
'<tableCell><paragraph>bbb</paragraph></tableCell>' +
'</tableRow>' +
'</table>' +
'[]' +
'<table>' +
'<tableRow>' +
'<tableCell><paragraph>xxx</paragraph></tableCell>' +
'<tableCell><paragraph>yyy</paragraph></tableCell>' +
'</tableRow>' +
'</table>' +
'<paragraph>baz</paragraph>'
);

assertEqualMarkup( getModelData( model ),
'<paragraph>foo</paragraph>' +
'[<table>' +
'<tableRow>' +
'<tableCell><paragraph>aaa</paragraph></tableCell>' +
'<tableCell><paragraph>bbb</paragraph></tableCell>' +
'</tableRow>' +
'</table>]' +
'<table>' +
'<tableRow>' +
'<tableCell><paragraph>xxx</paragraph></tableCell>' +
'<tableCell><paragraph>yyy</paragraph></tableCell>' +
'</tableRow>' +
'</table>' +
'<paragraph>baz</paragraph>'
);
} );

// There's a chance that this and the following test will not be up to date with
// how the table feature is really implemented once we'll introduce row/cells/columns selection
// in which case all these elements will need to be marked as objects.
Expand Down Expand Up @@ -1095,43 +1132,6 @@ describe( 'Selection post-fixer', () => {
'<paragraph>bar</paragraph>'
);
} );

it( 'should fix selection between tables', () => {
setModelData( model,
'<paragraph>foo</paragraph>' +
'<table>' +
'<tableRow>' +
'<tableCell><paragraph>aaa</paragraph></tableCell>' +
'<tableCell><paragraph>bbb</paragraph></tableCell>' +
'</tableRow>' +
'</table>' +
'[]' +
'<table>' +
'<tableRow>' +
'<tableCell><paragraph>xxx</paragraph></tableCell>' +
'<tableCell><paragraph>yyy</paragraph></tableCell>' +
'</tableRow>' +
'</table>' +
'<paragraph>baz</paragraph>'
);

assertEqualMarkup( getModelData( model ),
'<paragraph>foo</paragraph>' +
'[<table>' +
'<tableRow>' +
'<tableCell><paragraph>aaa</paragraph></tableCell>' +
'<tableCell><paragraph>bbb</paragraph></tableCell>' +
'</tableRow>' +
'</table>]' +
'<table>' +
'<tableRow>' +
'<tableCell><paragraph>xxx</paragraph></tableCell>' +
'<tableCell><paragraph>yyy</paragraph></tableCell>' +
'</tableRow>' +
'</table>' +
'<paragraph>baz</paragraph>'
);
} );
} );
} );
} );

0 comments on commit dcb7e6f

Please sign in to comment.