Skip to content

Commit

Permalink
refactor(app): special case 96-channel pipette mount text in drop tip…
Browse files Browse the repository at this point in the history
… wizard (#14175)

Closes RQA-2020
  • Loading branch information
mjhuff authored Dec 12, 2023
1 parent f813b79 commit 98d98f7
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 9 deletions.
7 changes: 5 additions & 2 deletions app/src/organisms/DropTipWizard/TipsAttachedModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const handleTipsAttachedModal = (

const TipsAttachedModal = NiceModal.create(
(props: TipsAttachedModalProps): JSX.Element => {
const { mount, onCloseClick } = props
const { mount, onCloseClick, instrumentModelSpecs } = props
const { t } = useTranslation(['drop_tip_wizard'])
const modal = useModal()
const [showWizard, setShowWizard] = React.useState(false)
Expand All @@ -51,6 +51,9 @@ const TipsAttachedModal = NiceModal.create(
iconColor: COLORS.yellow2,
}

const is96Channel = instrumentModelSpecs.channels === 96
const displayMountText = is96Channel ? '96-Channel' : capitalize(mount)

return (
<>
<Modal header={tipsAttachedHeader}>
Expand All @@ -60,7 +63,7 @@ const TipsAttachedModal = NiceModal.create(
t={t}
i18nKey="remove_the_tips"
values={{
mount: capitalize(mount),
mount: displayMountText,
}}
components={{
mount: <strong />,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ const MOCK_ACTUAL_PIPETTE = {

const mockOnClose = jest.fn()

const render = () => {
const render = (pipetteSpecs: PipetteModelSpecs) => {
return renderWithProviders(
<NiceModal.Provider>
<button
onClick={() =>
handleTipsAttachedModal(
LEFT,
MOCK_ACTUAL_PIPETTE,
pipetteSpecs,
ROBOT_MODEL_OT3,
mockOnClose
)
Expand All @@ -51,31 +51,45 @@ describe('TipsAttachedModal', () => {
})

it('renders appropriate warning given the pipette mount', () => {
const [{ getByTestId, getByText, queryByText }] = render()
const [{ getByTestId, getByText, queryByText }] = render(
MOCK_ACTUAL_PIPETTE
)
const btn = getByTestId('testButton')
fireEvent.click(btn)

getByText('Tips are attached')
queryByText(`${LEFT} Pipette`)
})

it('clicking the close button properly closes the modal', () => {
const [{ getByTestId, getByText }] = render()
const [{ getByTestId, getByText }] = render(MOCK_ACTUAL_PIPETTE)
const btn = getByTestId('testButton')
fireEvent.click(btn)

const skipBtn = getByText('Skip')
fireEvent.click(skipBtn)
expect(mockOnClose).toHaveBeenCalled()
})

it('clicking the launch wizard button properly launches the wizard', () => {
const [{ getByTestId, getByText }] = render()
const [{ getByTestId, getByText }] = render(MOCK_ACTUAL_PIPETTE)
const btn = getByTestId('testButton')
fireEvent.click(btn)

const skipBtn = getByText('Begin removal')
fireEvent.click(skipBtn)
getByText('Drop tips')
})
it('renders special text when the pipette is a 96-Channel', () => {
const ninetySixSpecs = {
...MOCK_ACTUAL_PIPETTE,
channels: 96,
} as PipetteModelSpecs

const [{ getByTestId, queryByText, getByText }] = render(ninetySixSpecs)
const btn = getByTestId('testButton')
fireEvent.click(btn)

const skipBtn = getByText('Begin removal')
fireEvent.click(skipBtn)
queryByText('96-Channel')
})
})

0 comments on commit 98d98f7

Please sign in to comment.