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

Widget / image resize tests refactoring #115

Merged
merged 64 commits into from
Feb 25, 2020
Merged

Widget / image resize tests refactoring #115

merged 64 commits into from
Feb 25, 2020

Conversation

mlewand
Copy link
Contributor

@mlewand mlewand commented Jan 15, 2020

Suggested merge commit message (convention)

Tests: Extracted relevant parts of widget resize plugin from the image back to widget plugin. Closes ckeditor/ckeditor5#4614.


Additional information

Not all the tests from imageresize are ported yet, I still want to move the size verification tests to new lower level unit tests in tests/widgetresize/resizer.js. The goal here was to push the PR sooner to get the feedback earlier.

There's a sub pr in ckeditor/ckeditor5-image#340

mlewand added 30 commits January 7, 2020 15:44
The editor was attempted to be removed twice.
It had wrong assertions previously. Also corrected test suite name.
… the object is resized as if it would be center-aligned.
…perly recognized.

Without this test added in b675585 is failing.
Also renamed a variable.
Dirty so far, will be cleaned up in a next commit.
Only partially so far, next part in next commit.
…moved.

Probably thanks to adjusting the size of the editor / editable.
Looks like it is no longer needed.
@coveralls
Copy link

coveralls commented Feb 10, 2020

Coverage Status

Coverage decreased (-2.3%) to 97.733% when pulling 34f4d3b on i/4614 into 886df83 on master.

@mlewand
Copy link
Contributor Author

mlewand commented Feb 11, 2020

I'm not sure about the above code coverage message, the CC has been maxed afterwards but I see no further messages.

There are three two tests failing (but it's an upstream issue, not caused by this PR).

Unfold this summary to see failing tests
FAILED TESTS:
Widget - integration
	× should do nothing if clicked inside a nested editable
	Chrome 80.0.3987 (Windows 10.0.0)
	AssertionError: expected '[<div class="ck-widget ck-widget_selected" contenteditable="false"><figcaption contenteditable="true">foo bar</figcaption></div>]' to equal '[]<div class="ck-widget" c
ontenteditable="false"><figcaption contenteditable="true">foo bar</figcaption></div>'

	+ expected - actual

	-[<div class="ck-widget ck-widget_selected" contenteditable="false"><figcaption contenteditable="true">foo bar</figcaption></div>]
	+[]<div class="ck-widget" contenteditable="false"><figcaption contenteditable="true">foo bar</figcaption></div>

	at Context.eval (webpack:///./packages/ckeditor5-widget/tests/widget-integration.js?:128:118)


	× should does nothing for non-Safari browser
	Chrome 80.0.3987 (Windows 10.0.0)
	AssertionError: expected '[<div class="ck-widget ck-widget_selected" contenteditable="false"><figcaption contenteditable="true">foo bar</figcaption></div>]' to equal '[]<div class="ck-widget" c
ontenteditable="false"><figcaption contenteditable="true">foo bar</figcaption></div>'

	+ expected - actual

	-[<div class="ck-widget ck-widget_selected" contenteditable="false"><figcaption contenteditable="true">foo bar</figcaption></div>]
	+[]<div class="ck-widget" contenteditable="false"><figcaption contenteditable="true">foo bar</figcaption></div>

	at Context.eval (webpack:///./packages/ckeditor5-widget/tests/widget-integration.js?:247:118)

That's caused by ckeditor/ckeditor5#6198 and not related to this issue.

There's one followup: ckeditor/ckeditor5#6214

} );
} );

describe( '_getResizerByHandle', () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
describe( '_getResizerByHandle', () => {
describe( '_getResizerByHandle()', () => {

Same for all other describes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pushed a fix for that and few other occurrences.

@Reinmar
Copy link
Member

Reinmar commented Feb 12, 2020

The existing tests look quite fine. What I miss... is this PR to be complete ;). It's hard to review this if I don't know what's missing.

Please remember – the goal is to have 100% CC in this package by having reasonable tests of this feature alone. You do test every single bit of this functionality differently, so I can only tell that so far I don't see bigger issues.

Copy link
Member

@Reinmar Reinmar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As commented.

@mlewand
Copy link
Contributor Author

mlewand commented Feb 12, 2020

The existing tests look quite fine. What I miss... is this PR to be complete ;)

@Reinmar Can you turn this into an actionable item? What is missing for the PR to be complete?

As for CC: the entire widgetresize and imageresize features have 100% CC. Image upload observer doesn't have 100% CC but this is outside of the scope of this PR.

@Reinmar
Copy link
Member

Reinmar commented Feb 12, 2020

As for CC: the entire widgetresize and imageresize features have 100% CC. Image upload observer doesn't have 100% CC but this is outside of the scope of this PR.

ckeditor5-image and ckeditor5-widget are separate packages and each of them separately should have 100% CC. Not together. Separately.

So, the items would be:

  • Make sure that ckeditor5-image has 100% CC
  • Make sure that ckeditor5-widget has 100% CC
  • Port all remaining tests that you're mentioning that you want to port

@Reinmar
Copy link
Member

Reinmar commented Feb 25, 2020

Still no 100% CC:

SUMMARY:
✔ 253 tests completed

=============================== Coverage summary ===============================
Statements   : 98.52% ( 534/542 )
Branches     : 96.12% ( 248/258 )
Functions    : 99.23% ( 129/130 )
Lines        : 98.51% ( 528/536 )
================================================================================
Coverage report saved in '/Users/p/Workspace/ckeditor5/coverage'.
✨  Done in 12.68s.

@Reinmar Reinmar merged commit d339a64 into master Feb 25, 2020
@Reinmar Reinmar deleted the i/4614 branch February 25, 2020 13:23
@Reinmar
Copy link
Member

Reinmar commented Feb 25, 2020

I extracted the CC to ckeditor/ckeditor5#6326.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rewrite widget resizer unit tests
3 participants