Skip to content

Commit

Permalink
plug in ResetValueModal
Browse files Browse the repository at this point in the history
  • Loading branch information
jerader committed Mar 19, 2024
1 parent 4e04ff5 commit d883da0
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
})
10 changes: 9 additions & 1 deletion app/src/organisms/ProtocolSetupParameters/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down Expand Up @@ -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<boolean>(
false
)

const handleConfirmValues = (): void => {
setSetupScreen('prepare to run')
Expand Down Expand Up @@ -194,6 +198,10 @@ export function ProtocolSetupParameters({

return (
<>
{resetValuesModal ? (
<ResetValuesModal handleGoBack={() => showResetValuesModal(false)} />
) : null}

<ChildNavigation
header={t('parameters')}
onClickBack={() => history.goBack()}
Expand All @@ -202,7 +210,7 @@ export function ProtocolSetupParameters({
secondaryButtonProps={{
buttonType: 'tertiaryLowLight',
buttonText: t('restore_default'),
onClick: () => console.log('TODO: wire this up!'),
onClick: () => showResetValuesModal(true),
}}
/>
<Flex
Expand Down

0 comments on commit d883da0

Please sign in to comment.