From fa85cb4880706b638f07c1e0d249cafbd997a23f Mon Sep 17 00:00:00 2001 From: ItsJonQ Date: Wed, 3 Jan 2018 11:19:11 -0500 Subject: [PATCH] Card: Fix autoWordWrap prop use for non-Links This update resolves the issue with `Card` when passing in the `autoWordWrap` prop for non-Link use. Previously, it would pass the prop into a `div` selector, resulting in a warning. Tests have been added for this update! :tada: --- src/components/Card/index.js | 2 ++ src/components/Card/tests/Card.test.js | 14 ++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/src/components/Card/index.js b/src/components/Card/index.js index e42fbb7eb..87130e9d9 100644 --- a/src/components/Card/index.js +++ b/src/components/Card/index.js @@ -36,6 +36,7 @@ const defaultProps = { const Card = props => { const { + autoWordWrap, borderless, className, children, @@ -68,6 +69,7 @@ const Card = props => { const element = href || to ? ( { expect(spy).toHaveBeenCalled() }) + + test('Does not pass autoWordWrap prop to div', () => { + const wrapper = shallow() + const o = wrapper.find('.c-Card') + + expect(o.props().autoWordWrap).toBeFalsy() + }) + + test('Can pass autoWordWrap to Link', () => { + const wrapper = shallow() + const o = wrapper.find('.c-Card') + + expect(o.props().autoWordWrap).toBeTruthy() + }) }) describe('Click', () => {