diff --git a/packages/react-component-library/src/components/Modal/Modal.stories.tsx b/packages/react-component-library/src/components/Modal/Modal.stories.tsx index 729afcea7c..5f2bca99b9 100644 --- a/packages/react-component-library/src/components/Modal/Modal.stories.tsx +++ b/packages/react-component-library/src/components/Modal/Modal.stories.tsx @@ -3,7 +3,7 @@ import { storiesOf } from '@storybook/react' import React from 'react' import { Modal } from './index' -import { ButtonProps } from '../Button' +import { BUTTON_COLOR, ButtonProps } from '../Button' const stories = storiesOf('Modal', module) const examples = storiesOf('Modal/Examples', module) @@ -60,6 +60,26 @@ examples.add('No buttons', () => { ) }) +examples.add('Danger primary button without icon', () => { + const primaryButtonWithoutIcon: ButtonProps = { + ...primaryButton, + color: BUTTON_COLOR.DANGER, + icon: undefined, + } + + return ( + +
Arbitrary JSX content
+
+ ) +}) + examples.add('No Tertiary Button', () => { return ( { ) }) }) + + describe('and no primary button icon is specified', () => { + beforeEach(() => { + wrapper = render( + + Example child JSX + + ) + }) + + it('does not render an icon for the primary button', () => { + expect( + wrapper.queryByTestId('modal-primary-confirm') + ).toBeNull() + }) + }) }) }) diff --git a/packages/react-component-library/src/components/Modal/Modal.tsx b/packages/react-component-library/src/components/Modal/Modal.tsx index 9017c83129..333846e17c 100644 --- a/packages/react-component-library/src/components/Modal/Modal.tsx +++ b/packages/react-component-library/src/components/Modal/Modal.tsx @@ -43,8 +43,8 @@ export const Modal: React.FC = ({ ) const primaryButtonWithIcon = primaryButton && { - ...primaryButton, icon: , + ...primaryButton, } return (