-
Notifications
You must be signed in to change notification settings - Fork 772
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(fxFlex): prevent setting min/max-size when grow/shrink is zero #160
fix(fxFlex): prevent setting min/max-size when grow/shrink is zero #160
Conversation
@d3viant0ne i'm on it, had forgotten to run the linter |
faf3087
to
f5409eb
Compare
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.
Code formatting/logic change.
@@ -301,8 +311,21 @@ export class FlexDirective extends BaseFxDirective implements OnInit, OnChanges, | |||
let usingCalc = String(basis).indexOf('calc') > -1; | |||
let isPx = String(basis).indexOf('px') > -1 || usingCalc; | |||
|
|||
css[min] = (basis == '0%') ? 0 : isPx ? basis : null; | |||
css[max] = (basis == '0%') ? 0 : usingCalc ? null : basis; |
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.
Plz use this:
// if shrink and grow are both zero then make box inflexible
// - should not set a min when the grow is zero
// - should not set a max when the shrink is zero
let isFixed = !grow && !shrink;
css[min] = (basis == '0%') ? 0 : isFixed || (isPx && grow) ? basis : null;
css[max] = (basis == '0%') ? 0 : isFixed || (!usingCalc && shrink) ? basis : null;
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.
Done.
Though it does look a bit awkward.
No Problem.
Thanks for looking over so quick.
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.
That's honestly a matter of perspective. You can get a lot evaluated, very concisely using a ternary and usually on a single line.
Once you get used to scanning it, the if ( )
conditions start to become a bit tedious to read / write.
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.
Sure, as long we get to a place where #153 and things stemming from it are resolved. I really done care much about the minor details..
Thanks for all the feadback!
f5409eb
to
b8b5d1c
Compare
@somombo - just an FYI that you will need to rebase your PR tomorrow after #158 is merged into master. At that point I can finish testing your PR and update to presubmit-for-merge. From a code perspective, these changes look good. Testing with the demos will reveal any issues.
|
@ThomasBurleson - Yeah, no problem! I tested with demos and everthing looked identical to before. By the way, none of the demos exemplify usage of something like |
@somombo - want to prepare a cool demo that highlights why your changes are useful ? That would be a great addition to this PR IMO. |
07d14ad
to
76e8bc2
Compare
@ThomasBurleson this is now rebased |
dad69fe
to
aaeb525
Compare
@somombo - Can you squash plz. Your change list looks huge for some reason. |
@ThomasBurleson could you post the commit hashes for the extraneous commits just so i know which ones you're referring to? |
So there's good news and bad news. 👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there. 😕 The bad news is that it appears that one or more commits were authored by someone other than the pull request submitter. We need to confirm that they're okay with their commits being contributed to this project. Please have them confirm that here in the pull request. Note to project maintainer: This is a terminal state, meaning the |
(@googlebot) I had changed my cla and my git email to somo@mombo.solutions for consistency. That someone was me in both cases |
@ThomasBurleson Okay I see what you are referring to now.. I'm not sure how to fix that, kindly advise |
try:
|
@ThomasBurleson Appears to not have done anything. Here is what I got for those three commands respectively:
|
76e8bc2
to
b09eff2
Compare
CLAs look good, thanks! |
@somombo - I added you as a contributor to this repository.
|
@here - CLA was signed. |
@ThomasBurleson Thanks! I appreciate it.. Does that mean for future PRs n patches, I should just work with the master branch on my fork.. rather than creating a |
@here sorry accidentally hit the "close pull request" button instead of the comment button |
@somombo - apologies, but a recent merge to master requires yet another rebase to this PR. |
handle various scenarios of grow/shrink being zero: * set `min-width`/`min-height` only if `grow != 0` * set `max-width`/`max-height` only if `shink != 0` * set both min and max if both `grow == 0` AND `shink == 0` * add tests for these scenarios * remove max-width from test "should set a min-width when the shrink == 0" fixes angular#153 Signed-off-by: Somo <somo@mombo.solutions>
028cf4b
to
830b968
Compare
CLAs look good, thanks! |
@ThomasBurleson is this good? |
@ThomasBurleson so what do I do next, do I hit the "squash and merge" or the "rebase and merge" button? |
@somombo - you should NEVER hit the Merge button(s). That is for the Core Team Admins only.
|
@ThomasBurleson I figured if there was something I wasn't supposed to do, the system would be set up so I wouldn't be able to do it.. but wasn't sure so good thing I asked :) |
@somombo - |
…ngular#160) handle various scenarios of grow/shrink being zero: * set `min-width`/`min-height` only if `grow != 0` * set `max-width`/`max-height` only if `shink != 0` * set both min and max if both `grow == 0` AND `shink == 0` * add tests for these scenarios * remove max-width from test "should set a min-width when the shrink == 0" fixes angular#153 Signed-off-by: Somo <somo@mombo.solutions>
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
handle various scenarios of grow/shrink being zero:
min-width
/min-height
only ifgrow != 0
max-width
/max-height
only ifshink != 0
grow == 0
ANDshink == 0
fixes #153
Signed-off-by: Somo somo@mombo.solutions