Skip to content

Commit

Permalink
feat: add more tests and improve some of the existing ones
Browse files Browse the repository at this point in the history
  • Loading branch information
flaminic committed Aug 13, 2024
1 parent 2414879 commit c0bc7a7
Show file tree
Hide file tree
Showing 6 changed files with 674 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,10 @@ export const ExchangeFormContents = React.memo(
</div>
</Subsection>
{typeValue === EXCHANGE_TYPES.external && (
<Subsection text={i18n.t('Target setup')}>
<Subsection
text={i18n.t('Target setup')}
dataTest="target-setup"
>
<EnableExternalEditWarning
editTargetSetupDisabled={editTargetSetupDisabled}
setEditTargetSetupDisabled={
Expand Down
5 changes: 4 additions & 1 deletion src/components/edit/request-update/request-form-contents.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ export const RequestFormContents = () => {
text={i18n.t('Request setup')}
className={styles.subsectionBlockEnd}
>
<div className={styles.subsectionField1000}>
<div
className={styles.subsectionField1000}
data-test="request-name"
>
<Field
name="requestName"
label={i18n.t('Request name')}
Expand Down
5 changes: 3 additions & 2 deletions src/components/edit/shared/form-subsection.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ AdvancedSubsection.propTypes = {
onTextClick: PropTypes.func,
}

export const Subsection = ({ text, children, className = '' }) => (
<div className={className}>
export const Subsection = ({ text, children, className = '', dataTest }) => (
<div className={className} data-test={dataTest || 'subsection'}>
<div className={styles.subtitleContainer}>
<div className={styles.subtitle}>{text}</div>
</div>
Expand All @@ -45,5 +45,6 @@ export const Subsection = ({ text, children, className = '' }) => (
Subsection.propTypes = {
children: PropTypes.node,
className: PropTypes.string,
dataTest: PropTypes.string,
text: PropTypes.string,
}
8 changes: 7 additions & 1 deletion src/components/edit/shared/update-footer.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@ import { useNavigate } from 'react-router-dom'

const DiscardModal = ({ open, onClose, onCancelConfirm, objectName }) => {
return (
<Modal hide={!open} large position="middle" onClose={onClose}>
<Modal
hide={!open}
large
position="middle"
onClose={onClose}
dataTest={`${objectName}-discard-modal`}
>
<ModalTitle>{i18n.t('Discard unsaved changes')}</ModalTitle>
<ModalContent>
<span>
Expand Down
Loading

0 comments on commit c0bc7a7

Please sign in to comment.