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

Create a test util for checking few assertions for different browsers #2927

Closed
pomek opened this issue Nov 13, 2017 · 3 comments · Fixed by ckeditor/ckeditor5-core#108
Closed
Assignees
Labels
package:core type:task This issue reports a chore (non-production change) and other types of "todos".
Milestone

Comments

@pomek
Copy link
Member

pomek commented Nov 13, 2017

Some of the tests fail because a selection on different browsers behave unpredictable but it is still correct.

For example – https://github.com/ckeditor/ckeditor5-link/issues/158#issuecomment-342729084 – this test fail on Edge because a selection is at the end of a element and inside it. Edge expects that the end of the selection will be after the element.

We could have the util which checks whether specified assertions are correct. If one of them will pass, the test is marked as passed. If all assertions will fail, the test is marked as fail and all errors will be logged.

it( 'test', () => {
	// Tests details...

	const assertEdge = () => {
	    expect( getData( doc ) ).to.equal(
	        '<$text bold="true" linkHref="url">f</$text>[<$text bold="true">ooba]<$text linkHref="url">r</$text></$text>'
	    );
	};

	const assertAll = () => {
	    expect( getData( doc ) ).to.equal(
	        '<$text bold="true" linkHref="url">f</$text>[<$text bold="true">ooba</$text>]<$text bold="true" linkHref="url">r</$text>'
	    );
	};

	checkAssertions( assertEdge, assertAll );
) );
@pomek pomek self-assigned this Nov 13, 2017
@Reinmar
Copy link
Member

Reinmar commented Nov 13, 2017

It doesn't need to be for "multiple browsers". Just "assert one passes" is fine.

@Reinmar
Copy link
Member

Reinmar commented Nov 13, 2017

BTW, doesn't chai support it? :O

@pomek
Copy link
Member Author

pomek commented Nov 14, 2017

BTW, doesn't chai support it? :O

I didn't find anything about it :(

szymonkups referenced this issue in ckeditor/ckeditor5-core Nov 16, 2017
Tests: Added a new test util `checkAssertions()`. It executes specified assertions and throws only when all assertions fail . Closes #107.
ma2ciek referenced this issue in ckeditor/ckeditor5-core Nov 28, 2017
Tests: Added a new test util `checkAssertions()`. It executes specified assertions and throws only when all assertions fail . Closes #107.
ma2ciek referenced this issue in ckeditor/ckeditor5-core Nov 28, 2017
Tests: Added a new test util `checkAssertions()`. It executes specified assertions and throws only when all assertions fail . Closes #107.
@mlewand mlewand transferred this issue from ckeditor/ckeditor5-core Oct 9, 2019
@mlewand mlewand added this to the iteration 14 milestone Oct 9, 2019
@mlewand mlewand added status:confirmed type:task This issue reports a chore (non-production change) and other types of "todos". package:core labels Oct 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package:core type:task This issue reports a chore (non-production change) and other types of "todos".
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants