[FlatButton] Fix Icon color prop issue#4160
Merged
mbrookes merged 1 commit intomui:masterfrom May 6, 2016
Merged
Conversation
0991d37 to
5248948
Compare
| if (icon) { | ||
| iconCloned = React.cloneElement(icon, { | ||
| color: mergedRootStyles.color, | ||
| color: icon.props.color, |
Member
There was a problem hiding this comment.
icon.props.color || mergedRootStyles.color ?
Contributor
Author
There was a problem hiding this comment.
Oh yeah..shoot. I missed the case when there is not color prop passed.
Thanks @mbrookes for pointing it out.
5248948 to
c9c6d99
Compare
Member
|
@tintin1343 That looks good. Do you want to write a test for this specific case? |
Contributor
Author
|
@oliviertassinari : Yeah sure. Let me give it a try. |
Contributor
Author
|
@oliviertassinari : Done. |
| /> | ||
| ); | ||
| const icon = wrapper.children().at(0); | ||
| assert.equal(icon.prop('color'), 'white', 'icon should have same color as that of color prop'); |
210a70d to
e5eb23e
Compare
| <FlatButton | ||
| backgroundColor="#a4c639" | ||
| hoverColor="#8AA62F" | ||
| icon={<ActionAndroid color={'white'} />} |
Member
There was a problem hiding this comment.
I would put 'white' in a variable so the link is explicit in the test.
Contributor
Author
There was a problem hiding this comment.
Alright. Thats a good idea.
e5eb23e to
a3490e9
Compare
Member
|
@tintin1343 That looks good, nice 👍. |
Contributor
Author
|
Rebase Done. |
a3490e9 to
cc830bf
Compare
| }); | ||
|
|
||
| it('colors the icon with the passed color in prop', () => { | ||
| let color = 'white'; |
Contributor
Author
There was a problem hiding this comment.
You are right. I changed it to const
cc830bf to
76fb046
Compare
Member
|
@tintin1343 Nice! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.