-
-
Notifications
You must be signed in to change notification settings - Fork 32.8k
[FlatButton] Fix Icon color prop issue #4160
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
Conversation
0991d37 to
5248948
Compare
src/FlatButton/FlatButton.js
Outdated
| if (icon) { | ||
| iconCloned = React.cloneElement(icon, { | ||
| color: mergedRootStyles.color, | ||
| color: icon.props.color, |
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.
icon.props.color || mergedRootStyles.color ?
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.
Oh yeah..shoot. I missed the case when there is not color prop passed.
Thanks @mbrookes for pointing it out.
5248948 to
c9c6d99
Compare
|
@tintin1343 That looks good. Do you want to write a test for this specific case? |
|
@oliviertassinari : Yeah sure. Let me give it a try. |
|
@oliviertassinari : Done. |
src/FlatButton/FlatButton.spec.js
Outdated
| /> | ||
| ); | ||
| const icon = wrapper.children().at(0); | ||
| assert.equal(icon.prop('color'), 'white', 'icon should have same color as that of color prop'); |
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.
strictEqual
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.
210a70d to
e5eb23e
Compare
src/FlatButton/FlatButton.spec.js
Outdated
| <FlatButton | ||
| backgroundColor="#a4c639" | ||
| hoverColor="#8AA62F" | ||
| icon={<ActionAndroid color={'white'} />} |
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 would put 'white' in a variable so the link is explicit in the 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.
Alright. Thats a good idea.
e5eb23e to
a3490e9
Compare
|
@tintin1343 That looks good, nice 👍. |
|
Rebase Done. |
a3490e9 to
cc830bf
Compare
src/FlatButton/FlatButton.spec.js
Outdated
| }); | ||
|
|
||
| it('colors the icon with the passed color in prop', () => { | ||
| let color = 'white'; |
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.
Shouldn't it be const?
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.
You are right. I changed it to const
cc830bf to
76fb046
Compare
|
@tintin1343 Nice! |
Resolves: #4144
color prop of icon was not being passed to the icon used within a flat-button
Replaced
color: mergedRootStyles.color,withcolor: icon.props.color,and that fixed it.