Skip to content
This repository has been archived by the owner on Feb 13, 2023. It is now read-only.

Commit

Permalink
Merge f9ec190 into b9af827
Browse files Browse the repository at this point in the history
  • Loading branch information
dusty committed Nov 3, 2018
2 parents b9af827 + f9ec190 commit f78e397
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/elements/Icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export interface Icon<T> extends Bulma.Size, Bulma.Alignment,

const isAlignOption = isOption(isLeft, isRight);

export function Icon({children, ...props }: Icon<HTMLElement>) {
export function Icon({ children, ...props }: Icon<HTMLElement>) {
const className = classNames(
'icon',
{
Expand All @@ -30,7 +30,7 @@ export function Icon({children, ...props }: Icon<HTMLElement>) {

const icon = (
<span {...HTMLProps} className={className}>
<i className={`${props.className}`} aria-hidden="true"></i>
{children ? children : (<i className={`${props.className}`} aria-hidden="true"></i>)}
</span>
);

Expand Down
9 changes: 9 additions & 0 deletions test/elements/Icon.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,13 @@ describe('Icon', () => {
</span>
)).toBe(true);
});

it('should render children instead of icon', () => {
const component = shallow(<Icon><span>child</span></Icon>)
expect(component.contains(
<span className='icon'>
<span>child</span>
</span>
)).toBe(true);
})
});

0 comments on commit f78e397

Please sign in to comment.