Skip to content

Commit

Permalink
Fix Icon className
Browse files Browse the repository at this point in the history
  • Loading branch information
CloudPower97 committed Nov 22, 2018
1 parent 75478ac commit 0d56e76
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
14 changes: 6 additions & 8 deletions src/Chip.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,12 @@ import PropTypes from 'prop-types';
import cx from 'classnames';
import Icon from './Icon';

const Chip = ({ children, close, className, ...props }) => {
return (
<div className={cx('chip', className)} {...props}>
{children}
{close && <Icon className="close material-icons">close</Icon>}
</div>
);
};
const Chip = ({ children, close, className, ...props }) => (
<div className={cx('chip', className)} {...props}>
{children}
{close && <Icon>close</Icon>}
</div>
);

Chip.propTypes = {
className: PropTypes.string,
Expand Down
2 changes: 1 addition & 1 deletion test/Chip.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe('<Chip />', () => {

test('accepts a close prop', () => {
wrapper = shallow(<Chip close />);
expect(wrapper.find('Icon.material-icons.close')).toHaveLength(1);
expect(wrapper.find('Icon')).toHaveLength(1);
});

test('accepts children', () => {
Expand Down
4 changes: 1 addition & 3 deletions test/__snapshots__/Chip.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ exports[`<Chip /> accepts children 1`] = `
>
Child
</p>
<Icon
className="close material-icons"
>
<Icon>
close
</Icon>
</div>
Expand Down

0 comments on commit 0d56e76

Please sign in to comment.