Add data-cy for modal components (#6015)

This commit is contained in:
Midhun Kumar E 2023-04-12 12:54:16 +05:30 committed by GitHub
parent a8c8280896
commit 97e1a73dc8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -116,6 +116,7 @@ export const Modal = function Modal({
setShowModal(true);
setExposedVariable('show', true).then(() => fireEvent('onOpen'));
}}
data-cy={`${dataCy}-launch-button`}
>
{triggerButtonLabel ?? 'Show Modal'}
</button>
@ -196,11 +197,14 @@ const Component = ({ children, ...restProps }) => {
/>
)}
{!hideTitleBar && (
<BootstrapModal.Header style={{ ...customStyles.modalHeader }}>
<BootstrapModal.Title id="contained-modal-title-vcenter">{title}</BootstrapModal.Title>
<BootstrapModal.Header style={{ ...customStyles.modalHeader }} data-cy={`modal-header`}>
<BootstrapModal.Title id="contained-modal-title-vcenter" data-cy={`modal-title`}>
{title}
</BootstrapModal.Title>
{!hideCloseButton && (
<span
className="cursor-pointer"
data-cy={`modal-close-button`}
size="sm"
onClick={(e) => {
e.preventDefault();
@ -228,7 +232,7 @@ const Component = ({ children, ...restProps }) => {
)}
</BootstrapModal.Header>
)}
<BootstrapModal.Body style={{ ...customStyles.modalBody }} ref={parentRef} id={id}>
<BootstrapModal.Body style={{ ...customStyles.modalBody }} ref={parentRef} id={id} data-cy={`modal-body`}>
{children}
</BootstrapModal.Body>
</BootstrapModal>