From eea3d72ffc0c4a46780ee881b4e7b79dca36a04f Mon Sep 17 00:00:00 2001 From: Keith Grant Date: Thu, 2 May 2019 10:02:45 -0400 Subject: [PATCH] add CardCloseButton tests --- __tests__/components/CardCloseButton.test.jsx | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 __tests__/components/CardCloseButton.test.jsx diff --git a/__tests__/components/CardCloseButton.test.jsx b/__tests__/components/CardCloseButton.test.jsx new file mode 100644 index 0000000000..f341201f60 --- /dev/null +++ b/__tests__/components/CardCloseButton.test.jsx @@ -0,0 +1,23 @@ +import React from 'react'; +import { mountWithContexts } from '../enzymeHelpers'; +import CardCloseButton from '../../src/components/CardCloseButton'; + +describe('', () => { + test('should render close button', () => { + const wrapper = mountWithContexts(); + const button = wrapper.find('Button'); + expect(button).toHaveLength(1); + expect(button.prop('variant')).toBe('plain'); + expect(button.prop('className')).toBe('pf-c-card__close'); + expect(wrapper.find('Link')).toHaveLength(0); + }); + + test('should render close link when `linkTo` prop provided', () => { + const wrapper = mountWithContexts(); + expect(wrapper.find('Button')).toHaveLength(0); + const link = wrapper.find('Link'); + expect(link).toHaveLength(1); + expect(link.prop('to')).toEqual('/foo'); + expect(link.prop('className')).toEqual('pf-c-button pf-c-card__close'); + }); +});