Skip to content

Commit e5eb23e

Browse files
committed
[FlatButton] Test to check icon color in FlatButton
1 parent c9c6d99 commit e5eb23e

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

src/FlatButton/FlatButton.spec.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {shallow} from 'enzyme';
44
import {assert} from 'chai';
55
import FlatButton from './FlatButton';
66
import getMuiTheme from '../styles/getMuiTheme';
7+
import ActionAndroid from '../svg-icons/action/android';
78

89
describe('<FlatButton />', () => {
910
const muiTheme = getMuiTheme();
@@ -92,6 +93,18 @@ 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 wrapper = shallowWithContext(
98+
<FlatButton
99+
backgroundColor="#a4c639"
100+
hoverColor="#8AA62F"
101+
icon={<ActionAndroid color={'white'} />}
102+
/>
103+
);
104+
const icon = wrapper.children().at(0);
105+
assert.strictEqual(icon.prop('color'), 'white', 'icon should have same color as that of color prop');
106+
});
107+
95108
it('colors the button the secondary theme color', () => {
96109
const wrapper = shallowWithContext(
97110
<FlatButton secondary={true} icon={<span className="test-icon" />}>Button</FlatButton>

0 commit comments

Comments
 (0)