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

Fixed resizer initial percentage values for sie images #308

Merged
merged 10 commits into from Oct 3, 2019
Merged

Conversation

mlewand
Copy link
Contributor

@mlewand mlewand commented Aug 19, 2019

Suggested merge commit message (convention)

Fix: Initial resize of a side image with no width predefined now gives correct percentage values. Closes ckeditor/ckeditor5#5190.


Additional information

Requires a following PR: ckeditor/ckeditor5-widget#103.

@coveralls
Copy link

coveralls commented Aug 19, 2019

Coverage Status

Coverage increased (+0.1%) to 99.803% when pulling 1838622 on t/306 into f1e36bc on master.

@jodator jodator self-assigned this Aug 21, 2019
@jodator jodator self-requested a review August 21, 2019 09:24
Copy link
Contributor

@jodator jodator left a comment

Choose a reason for hiding this comment

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

👍 The PR itself is OK. I've added some comments about the tests here: https://github.com/ckeditor/ckeditor5-image/issues/304#issuecomment-523374354.

Only thing is that this https://github.com/ckeditor/ckeditor5-image/issues/314 is still an issue. (th3 #306 case looks solved).

@Reinmar
Copy link
Member

Reinmar commented Aug 21, 2019

Same as in ckeditor/ckeditor5-widget#103 – I'd like to look into this still so, removing R+ for now.

describe( 'percent resizing', () => {
describe( 'standard image', () => {
beforeEach( async () => {
await editor.destroy();
Copy link
Member

Choose a reason for hiding this comment

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

This is odd. Please create the right editor for the specific describe block. Creating 2 editors for no reason is both confusing and slows down the tests.

@Reinmar Reinmar self-assigned this Sep 19, 2019
describe( 'percent resizing', () => {
describe( 'standard image', () => {
before( () => {
customConfig = CONFIG_RESIZE_IN_PIXELS;
Copy link
Member

Choose a reason for hiding this comment

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

You mean in percentage? Pixels are the default in this test file.

Copy link
Member

Choose a reason for hiding this comment

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

BTW, we tend to simply repeat .create() calls in each test file instead of deduplicating it like this. It's easier to read the code if it's closer to you and doesn't have conditions inside.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not entirely sure about this one, it introduces notable code repetition across the file. Added changes in t/306b branch, can be compared to t/306.

Copy link
Member

Choose a reason for hiding this comment

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

Tests are all about readability. If you need to jump to 10 places to understand what a single TC does, you have a problem. Therefore, repetition is better. Or rather – keeping as much code locally in a TC is better.

beforeEach( () => {
setData( editor.model, `<paragraph>foo</paragraph>[<image src="${ IMAGE_SRC_FIXTURE }"></image>]` );

view = editor.editing.view;
Copy link
Member

Choose a reason for hiding this comment

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

This duplicates the code from the topmost beforeEach().

@mlewand
Copy link
Contributor Author

mlewand commented Sep 20, 2019

Pushed changes to t/306. Comment #308 (comment) was addressed on branch t/306b.

@Reinmar Reinmar merged commit b084de5 into master Oct 3, 2019
@Reinmar Reinmar deleted the t/306 branch October 3, 2019 09:23
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
4 participants