File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -221,7 +221,7 @@ class FlatButton extends Component {
221221
222222 if ( icon ) {
223223 iconCloned = React . cloneElement ( icon , {
224- color : mergedRootStyles . color ,
224+ color : icon . props . color || mergedRootStyles . color ,
225225 style : {
226226 verticalAlign : 'middle' ,
227227 marginLeft : label && labelPosition !== 'before' ? 12 : 0 ,
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import {shallow} from 'enzyme';
44import { assert } from 'chai' ;
55import FlatButton from './FlatButton' ;
66import getMuiTheme from '../styles/getMuiTheme' ;
7+ import ActionAndroid from '../svg-icons/action/android' ;
78
89describe ( '<FlatButton />' , ( ) => {
910 const muiTheme = getMuiTheme ( ) ;
@@ -92,6 +93,19 @@ describe('<FlatButton />', () => {
9293 assert . ok ( icon . is ( { color : flatButtonTheme . primaryTextColor } ) ) ;
9394 } ) ;
9495
96+ it ( 'colors the icon with the passed color in prop' , ( ) => {
97+ const color = 'white' ;
98+ const wrapper = shallowWithContext (
99+ < FlatButton
100+ backgroundColor = "#a4c639"
101+ hoverColor = "#8AA62F"
102+ icon = { < ActionAndroid color = { color } /> }
103+ />
104+ ) ;
105+ const icon = wrapper . find ( 'ActionAndroid' ) ;
106+ assert . strictEqual ( icon . prop ( 'color' ) , color , 'icon should have same color as that of color prop' ) ;
107+ } ) ;
108+
95109 it ( 'colors the button the secondary theme color' , ( ) => {
96110 const wrapper = shallowWithContext (
97111 < FlatButton secondary = { true } icon = { < span className = "test-icon" /> } > Button</ FlatButton >
You can’t perform that action at this time.
0 commit comments