diff --git a/app/src/organisms/ProtocolSetupParameters/__tests__/ProtocolSetupParameters.test.tsx b/app/src/organisms/ProtocolSetupParameters/__tests__/ProtocolSetupParameters.test.tsx index 326fdc27920..e2c4992b199 100644 --- a/app/src/organisms/ProtocolSetupParameters/__tests__/ProtocolSetupParameters.test.tsx +++ b/app/src/organisms/ProtocolSetupParameters/__tests__/ProtocolSetupParameters.test.tsx @@ -59,4 +59,17 @@ describe('ProtocolSetupParameters', () => { fireEvent.click(screen.getByRole('button', { name: 'Confirm values' })) expect(props.setSetupScreen).toHaveBeenCalled() }) + it('renders the reset values modal', () => { + render(props) + fireEvent.click( + screen.getByRole('button', { name: 'Restore default values' }) + ) + screen.getByText( + 'This will discard any changes you have made. All parameters will have their default values.' + ) + const title = screen.getByText('Reset parameter values?') + fireEvent.click(screen.getByRole('button', { name: 'Go back' })) + expect(title).not.toBeInTheDocument() + // TODO(jr, 3/19/24): wire up the confirm button + }) }) diff --git a/app/src/organisms/ProtocolSetupParameters/index.tsx b/app/src/organisms/ProtocolSetupParameters/index.tsx index 28dee8d82b3..ac3403dd740 100644 --- a/app/src/organisms/ProtocolSetupParameters/index.tsx +++ b/app/src/organisms/ProtocolSetupParameters/index.tsx @@ -10,6 +10,7 @@ import { import { ProtocolSetupStep, SetupScreens } from '../../pages/ProtocolSetup' import { useMostRecentCompletedAnalysis } from '../LabwarePositionCheck/useMostRecentCompletedAnalysis' import { ChildNavigation } from '../ChildNavigation' +import { ResetValuesModal } from './ResetValuesModal' import type { RunTimeParameter } from '@opentrons/shared-data' @@ -157,6 +158,9 @@ export function ProtocolSetupParameters({ const { t, i18n } = useTranslation('protocol_setup') const history = useHistory() const mostRecentAnalysis = useMostRecentCompletedAnalysis(runId) + const [resetValuesModal, showResetValuesModal] = React.useState( + false + ) const handleConfirmValues = (): void => { setSetupScreen('prepare to run') @@ -194,6 +198,10 @@ export function ProtocolSetupParameters({ return ( <> + {resetValuesModal ? ( + showResetValuesModal(false)} /> + ) : null} + history.goBack()} @@ -202,7 +210,7 @@ export function ProtocolSetupParameters({ secondaryButtonProps={{ buttonType: 'tertiaryLowLight', buttonText: t('restore_default'), - onClick: () => console.log('TODO: wire this up!'), + onClick: () => showResetValuesModal(true), }} />