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

Commit

Permalink
Merge pull request #171 from helpscout/Card/fix-autoWordWrap-prop
Browse files Browse the repository at this point in the history
Card: Fix autoWordWrap prop use for non-Links
  • Loading branch information
ItsJonQ authored Jan 3, 2018
2 parents 74051d6 + fa85cb4 commit 83df19b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/components/Card/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const defaultProps = {

const Card = props => {
const {
autoWordWrap,
borderless,
className,
children,
Expand Down Expand Up @@ -68,6 +69,7 @@ const Card = props => {

const element = href || to ? (
<Link
autoWordWrap={autoWordWrap}
block
className={componentClassName}
onClick={onClick}
Expand Down
14 changes: 14 additions & 0 deletions src/components/Card/tests/Card.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,20 @@ describe('Link', () => {

expect(spy).toHaveBeenCalled()
})

test('Does not pass autoWordWrap prop to div', () => {
const wrapper = shallow(<Card autoWordWrap />)
const o = wrapper.find('.c-Card')

expect(o.props().autoWordWrap).toBeFalsy()
})

test('Can pass autoWordWrap to Link', () => {
const wrapper = shallow(<Card href={link} autoWordWrap />)
const o = wrapper.find('.c-Card')

expect(o.props().autoWordWrap).toBeTruthy()
})
})

describe('Click', () => {
Expand Down

0 comments on commit 83df19b

Please sign in to comment.