diff --git a/packages/react/src/components/ComposedModal/ComposedModal-test.js b/packages/react/src/components/ComposedModal/ComposedModal-test.js
index 540b0a5e4ce2..46763e563d21 100644
--- a/packages/react/src/components/ComposedModal/ComposedModal-test.js
+++ b/packages/react/src/components/ComposedModal/ComposedModal-test.js
@@ -13,6 +13,7 @@ import ComposedModal, {
ModalBody,
ModalFooter,
} from '../ComposedModal';
+import InlineLoading from '../InlineLoading';
import { settings } from 'carbon-components';
const { prefix } = settings;
@@ -97,7 +98,7 @@ describe('', () => {
});
});
- describe('Should render buttons only if appropriate prop passed in in', () => {
+ describe('Should render buttons only if appropriate prop passed in', () => {
const wrapper = shallow(
Test
@@ -105,8 +106,20 @@ describe('', () => {
);
const primaryWrapper = shallow();
- const secondaryWrapper = shallow(
-
+ const secondaryWrapper = mount();
+ const multipleSecondaryWrapper = mount(
+ ,
+ onClick: jest.fn(),
+ },
+ {
+ buttonText: 'Cancel',
+ onClick: jest.fn(),
+ },
+ ]}
+ />
);
it('does not render primary button if no primary text', () => {
@@ -128,15 +141,36 @@ describe('', () => {
expect(buttonComponent.exists()).toBe(true);
expect(buttonComponent.props().kind).toBe('secondary');
});
+
+ it('correctly renders multiple secondary buttons', () => {
+ const buttonComponents = multipleSecondaryWrapper.find(Button);
+ expect(buttonComponents.length).toEqual(2);
+ expect(buttonComponents.at(0).props().kind).toBe('secondary');
+ expect(buttonComponents.at(1).props().kind).toBe('secondary');
+ });
});
describe('Should render the appropriate buttons when `danger` prop is true', () => {
const primaryWrapper = shallow(
);
- const secondaryWrapper = shallow(
+ const secondaryWrapper = mount(
);
+ const multipleSecondaryWrapper = mount(
+ ,
+ onClick: jest.fn(),
+ },
+ {
+ buttonText: 'Cancel',
+ onClick: jest.fn(),
+ },
+ ]}
+ />
+ );
it('renders danger button if primary text && danger', () => {
const buttonComponent = primaryWrapper.find(Button);
@@ -149,6 +183,13 @@ describe('', () => {
expect(buttonComponent.exists()).toBe(true);
expect(buttonComponent.prop('kind')).toBe('secondary');
});
+
+ it('correctly renders multiple secondary buttons', () => {
+ const buttonComponents = multipleSecondaryWrapper.find(Button);
+ expect(buttonComponents.length).toEqual(2);
+ expect(buttonComponents.at(0).props().kind).toBe('secondary');
+ expect(buttonComponents.at(1).props().kind).toBe('secondary');
+ });
});
});