Skip to content

Commit

Permalink
fix(app): disable exit button after successful pipette attach/detach (#…
Browse files Browse the repository at this point in the history
…15205)

Closes RQA-2731

On OT-2, after a pipette is attached or detached successfully, the exit
button should only be clickable once, so that many home commands are not
emitted in rapid succession with each click.
  • Loading branch information
ncdiehl11 committed May 16, 2024
1 parent 737865d commit a84f58a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
10 changes: 9 additions & 1 deletion app/src/organisms/ChangePipette/ConfirmPipette.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export function ConfirmPipette(props: ConfirmPipetteProps): JSX.Element {
actualPipette,
setConfirmPipetteLevel,
confirmPipetteLevel,
isDisabled,
} = props
const { t } = useTranslation('change_pipette')

Expand Down Expand Up @@ -141,6 +142,7 @@ export function ConfirmPipette(props: ConfirmPipetteProps): JSX.Element {
<SuccessAndExitButtons
{...props}
confirmPipetteLevel={confirmPipetteLevel}
isDisabled={isDisabled}
/>
) : null}
</>
Expand Down Expand Up @@ -221,6 +223,7 @@ function SuccessAndExitButtons(props: ConfirmPipetteProps): JSX.Element {
toCalibrationDashboard,
success,
wrongWantedPipette,
isDisabled,
} = props
const { t } = useTranslation('change_pipette')
return (
Expand All @@ -230,11 +233,16 @@ function SuccessAndExitButtons(props: ConfirmPipetteProps): JSX.Element {
<SecondaryButton
marginRight={SPACING.spacing8}
onClick={toCalibrationDashboard}
disabled={isDisabled}
>
{t('calibrate_pipette_offset')}
</SecondaryButton>
) : null}
<PrimaryButton textTransform={TEXT_TRANSFORM_CAPITALIZE} onClick={exit}>
<PrimaryButton
textTransform={TEXT_TRANSFORM_CAPITALIZE}
onClick={exit}
disabled={isDisabled}
>
{t('shared:exit')}
</PrimaryButton>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,19 @@ describe('ConfirmPipette', () => {
fireEvent.click(pocBtn)
expect(props.toCalibrationDashboard).toBeCalled()
})
it('should render buttons as disabled when robot is in motion/isDisabled is true', () => {
it('should render buttons as disabled on success when robot is in motion/isDisabled is true', () => {
props = {
...props,
success: true,
isDisabled: true,
}
const { getByRole } = render(props)
expect(getByRole('button', { name: 'exit' })).toBeDisabled()
expect(
getByRole('button', { name: 'Calibrate pipette offset' })
).toBeDisabled()
})
it('should render buttons as disabled on failure when robot is in motion/isDisabled is true', () => {
props = {
...props,
success: false,
Expand Down

0 comments on commit a84f58a

Please sign in to comment.