Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rethink table test utils. #3240

Closed
jodator opened this issue Oct 2, 2018 · 1 comment
Closed

Rethink table test utils. #3240

jodator opened this issue Oct 2, 2018 · 1 comment
Labels
package:table resolution:duplicate This issue is a duplicate of another issue and was merged into it. status:discussion type:question This issue asks a question (how to...).

Comments

@jodator
Copy link
Contributor

jodator commented Oct 2, 2018

As @Reinmar pointed-out: ckeditor/ckeditor5-table#127 (comment).

The table tests might not be easy to read because of use modelTable() helpers (as I think).

Those methods were created to quickly write table (layout) tests so instead of writing:

setData( model,
	'<table>' +
		'<tableRow>' +
			'<tableCell><paragraph>00[]</paragraph></tableCell>' +
			'<tableCell><paragraph>01</paragraph></tableCell>' +
		'</tableRow>' +
		'<tableRow>' +
			'<tableCell><paragraph>10</paragraph></tableCell>' +
			'<tableCell><paragraph>11</paragraph></tableCell>' +
		'</tableRow>' +
	'</table>'
);

The helper creates proper structure:

setData( model, modelTable( [
	[ '00[]', '01' ],
	[ '10', '11' ]
] ) );

Note: similar helper is created for the view which properly stub table string with all widget markup.

This helper can create also proper <thead>/<tobdy> section (for the view), add arbitrary attributes to the table cell. And will also create a table with other children then <paragraph> if they are provided as content.

While it is easier to write them other devs have to learn them to know what happens in some cases.

My question is: do we have some other ideas for the above?

@mlewand mlewand transferred this issue from ckeditor/ckeditor5-table Oct 9, 2019
@mlewand mlewand added this to the backlog milestone Oct 9, 2019
@mlewand mlewand added status:discussion type:question This issue asks a question (how to...). package:table labels Oct 9, 2019
@jodator jodator removed this from the backlog milestone May 26, 2020
@jodator
Copy link
Contributor Author

jodator commented May 26, 2020

Closing in favour of the recent one #6574. This issue is outdated and the tests needs to be updated as the feature grow.

We also introduce a tool by @niegowski that allows to create better comments in tests when needed.

@jodator jodator closed this as completed May 26, 2020
@Reinmar Reinmar added the resolution:duplicate This issue is a duplicate of another issue and was merged into it. label Jun 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package:table resolution:duplicate This issue is a duplicate of another issue and was merged into it. status:discussion type:question This issue asks a question (how to...).
Projects
None yet
Development

No branches or pull requests

3 participants