-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Fix: Incomplete CSS margin parsing if "auto" or "0" without unit is used #4270
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if we need manual test here since it doesn't bring any additional value over unit tests. We just need to check input - output of this method. And since it is more an integration test than unit one (checking entire flow using editor instance) we have (almost) exactly the same execution flow as in manual test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good 👍 Unit tests are now where they should be too.
I only had some doubts related to used regex (both versions in fact), please see my comment.
Rebased onto latest |
Red CI is caused by #4285. |
Rebased onto latest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added two unit tests checking backwards compatibility for handling invalid (or partially invalid) values. It would be good to keep this behavior consistent since they may be some editor parts (hopefully not) which relays on this behavior. It turned out that || [ '0px' ]
alternative (mentioned somewhere in #4270 (comment)) is still needed 🙈
Now it handles invalid values the same way it did before, but some tests fails on IEs. It would be good to check what's going on. Since also invalid values tests fails there it might be good to check how it behaved with the previous regexp version there.
IE8:
IE9/IE10/IE11:
It seems that IE completely removes any invalid styles that occurs in code 🤔
@f1ames, should we omit testing invalid values in IE? |
Yes, if IE just doesn't accept invalid values we may skip those tests 👍 Btw. have you checked if it works the same with the previous regexp (if it's a browser fault it should).
I assume it is also removed in IE8 as invalid value. Is there any unit we can use here instead of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #4270 (comment).
Yes, it works on IE8. I assume we want to change |
@f1ames I've replaced `rem` with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
What is the purpose of this pull request?
Bug fix
Does your PR contain necessary tests?
All patches that change the editor code must include tests. You can always read more
on PR testing,
how to set the testing environment and
how to create tests
in the official CKEditor documentation.
This PR contains
Did you follow the CKEditor 4 code style guide?
Your code should follow the guidelines from the CKEditor 4 code style guide which helps keep the entire codebase consistent.
What is the proposed changelog entry for this pull request?
What changes did you make?
Changed regex for
splitMarginShorthand
function so it now converts margin shorthands correctly.Which issues does your PR resolve?
Closes #1330.