Skip to content

Commit

Permalink
[FlatButton] Test to check icon color in FlatButton
Browse files Browse the repository at this point in the history
  • Loading branch information
tintin1343 committed May 5, 2016
1 parent c9c6d99 commit a3490e9
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/FlatButton/FlatButton.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {shallow} from 'enzyme';
import {assert} from 'chai';
import FlatButton from './FlatButton';
import getMuiTheme from '../styles/getMuiTheme';
import ActionAndroid from '../svg-icons/action/android';

describe('<FlatButton />', () => {
const muiTheme = getMuiTheme();
Expand Down Expand Up @@ -92,6 +93,19 @@ describe('<FlatButton />', () => {
assert.ok(icon.is({color: flatButtonTheme.primaryTextColor}));
});

it('colors the icon with the passed color in prop', () => {
let color = 'white';
const wrapper = shallowWithContext(
<FlatButton
backgroundColor="#a4c639"
hoverColor="#8AA62F"
icon={<ActionAndroid color={color} />}
/>
);
const icon = wrapper.find('ActionAndroid');
assert.strictEqual(icon.prop('color'), color, 'icon should have same color as that of color prop');
});

it('colors the button the secondary theme color', () => {
const wrapper = shallowWithContext(
<FlatButton secondary={true} icon={<span className="test-icon" />}>Button</FlatButton>
Expand Down

0 comments on commit a3490e9

Please sign in to comment.