Skip to content

Commit

Permalink
refactor(app): update LPC description copy (#8493)
Browse files Browse the repository at this point in the history
closes #8215
  • Loading branch information
jerader committed Oct 11, 2021
1 parent ee22043 commit 914f5cc
Show file tree
Hide file tree
Showing 3 changed files with 127 additions and 16 deletions.
3 changes: 1 addition & 2 deletions app/src/assets/localization/en/labware_position_check.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"labware_position_check_title": "Labware Position Check",
"labware_position_check_overview": "Labware Position Check Overview",
"position_check_description_1": "Labware Position Check is a guided workflow that checks every labware on the deck for an added degree of precision in your protocol.",
"position_check_description_2": "When you check a labware, the OT-2’s pipette nozzle or attached tip will stop at the center of the A1 well. If the pipette nozzle or tip is not centered, you can reveal the OT-2’s jog controls to make an adjustment. This Labware Offset will be applied to the entire labware. Offset data is measured to the nearest 1/10th mm and can be made in the X, Y and/or Z directions.",
"position_check_description": "<block>Labware Position Check is a guided workflow that checks every labware on the deck for an added degree of precision in your protocol.</block><block>When you check a labware, the OT-2’s pipette nozzle or attached tip will stop at the center of the A1 well. If the pipette nozzle or tip is not centered, you can reveal the OT-2’s jog controls to make an adjustment. This Labware Offset will be applied to the entire labware. Offset data is measured to the nearest 1/10th mm and can be made in the X, Y and/or Z directions.</block>",
"secondary_pipette_tipracks_section": "Check tipracks with {{secondary_mount}} Pipette",
"primary_pipette_tipracks_section": "Check tipracks with {{primary_mount}} Pipette",
"check_remaining_labware_with_primary_pipette_section": "Check remaining labware with {{primary_mount}} Pipette",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react'
import { useTranslation } from 'react-i18next'
import { Trans, useTranslation } from 'react-i18next'
import map from 'lodash/map'

import {
Expand All @@ -20,7 +20,6 @@ import {
SPACING_3,
SPACING_4,
FONT_SIZE_BODY_2,
LINE_HEIGHT_COPY,
} from '@opentrons/components'
import {
THERMOCYCLER_MODULE_V1,
Expand Down Expand Up @@ -70,24 +69,19 @@ export const IntroScreen = (props: {
>
{t('labware_position_check_overview')}
</Text>
<Text
as={'p'}
fontSize={FONT_SIZE_BODY_2}
lineHeight={LINE_HEIGHT_COPY}
marginBottom={SPACING_2}
>
{t('position_check_description_1')}
</Text>
<Text as={'p'} fontSize={FONT_SIZE_BODY_2} lineHeight={LINE_HEIGHT_COPY}>
{t('position_check_description_2')}
</Text>
<Trans
t={t}
i18nKey="position_check_description"
components={{
block: <Text fontSize={FONT_SIZE_BODY_2} marginBottom={SPACING_2} />,
}}
></Trans>
<Flex justifyContent={JUSTIFY_SPACE_BETWEEN} alignItems={ALIGN_CENTER}>
<PositionCheckNav
sections={sections}
primaryPipetteMount={primaryPipetteMount}
secondaryPipetteMount={secondaryPipetteMount}
/>

<Box width="60%" padding={SPACING_3}>
<RobotWorkSpace
deckDef={standardDeckDef as any}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
import * as React from 'react'
import { when } from 'jest-when'
import {
partialComponentPropsMatcher,
renderWithProviders,
} from '@opentrons/components/src/testing/utils'
import { RobotWorkSpace } from '@opentrons/components'
import { i18n } from '../../../../i18n'
import standardDeckDef from '@opentrons/shared-data/deck/definitions/2/ot2_standard.json'
import { LabwareDefinition2 } from '@opentrons/shared-data'
import fixture_tiprack_300_ul from '@opentrons/shared-data/labware/fixtures/2/fixture_tiprack_300_ul.json'
import { useModuleRenderInfoById, useLabwareRenderInfoById } from '../../hooks'
import { PositionCheckNav } from '../PositionCheckNav'
import { useIntroInfo } from '../hooks'
import { IntroScreen } from '../IntroScreen'
import type { Section } from '../types'

jest.mock('../hooks')
jest.mock('../PositionCheckNav')
jest.mock('../../hooks')
jest.mock('@opentrons/components', () => {
const actualComponents = jest.requireActual('@opentrons/components')
return {
...actualComponents,
RobotWorkSpace: jest.fn(() => <div>mock RobotWorkSpace</div>),
}
})

const mockUseModuleRenderInfoById = useModuleRenderInfoById as jest.MockedFunction<
typeof useModuleRenderInfoById
>
const mockUseLabwareRenderInfoById = useLabwareRenderInfoById as jest.MockedFunction<
typeof useLabwareRenderInfoById
>
const mockUseIntroInfo = useIntroInfo as jest.MockedFunction<
typeof useIntroInfo
>
const mockPositionCheckNav = PositionCheckNav as jest.MockedFunction<
typeof PositionCheckNav
>
const mockRobotWorkSpace = RobotWorkSpace as jest.MockedFunction<
typeof RobotWorkSpace
>
const deckSlotsById = standardDeckDef.locations.orderedSlots.reduce(
(acc, deckSlot) => ({ ...acc, [deckSlot.id]: deckSlot }),
{}
)
const MOCK_SECTIONS = ['MOCK_PRIMARY_PIPETTE_TIPRACKS' as Section]
const MOCK_300_UL_TIPRACK_COORDS = [30, 40, 0]

const render = (props: React.ComponentProps<typeof IntroScreen>) => {
return renderWithProviders(<IntroScreen {...props} />, {
i18nInstance: i18n,
})[0]
}

describe('IntroScreen', () => {
let props: React.ComponentProps<typeof IntroScreen>

beforeEach(() => {
props = {
setCurrentLabwareCheckStep: () => {},
}
when(mockRobotWorkSpace)
.mockReturnValue(<div></div>) // this (default) empty div will be returned when RobotWorkSpace isn't called with expected props
.calledWith(
partialComponentPropsMatcher({
deckDef: standardDeckDef,
children: expect.anything(),
})
)
.mockImplementation(({ children }) => (
<svg>
{/* @ts-expect-error children won't be null since we checked for expect.anything() above */}
{children({
deckSlotsById,
getRobotCoordsFromDOMCoords: {} as any,
})}
</svg>
))
when(mockUseLabwareRenderInfoById)
.calledWith()
.mockReturnValue({
'300_ul_tiprack_id': {
labwareDef: fixture_tiprack_300_ul as LabwareDefinition2,
x: MOCK_300_UL_TIPRACK_COORDS[0],
y: MOCK_300_UL_TIPRACK_COORDS[1],
z: MOCK_300_UL_TIPRACK_COORDS[2],
},
})
when(mockUseModuleRenderInfoById).calledWith().mockReturnValue({})

when(mockUseIntroInfo).calledWith().mockReturnValue({
primaryTipRackSlot: '1',
primaryTipRackName: 'Opentrons 96 Tip Rack 300 µL',
primaryPipetteMount: 'left',
secondaryPipetteMount: '',
numberOfTips: 1,
firstStepLabwareSlot: '2',
sections: MOCK_SECTIONS,
})
mockPositionCheckNav.mockReturnValue(<div>Mock Position Check Nav</div>)
})

it('renders correct heading and position_check_description', () => {
const { getByRole, getByText } = render(props)
getByRole('heading', {
name: 'Labware Position Check Overview',
})
getByText(
'Labware Position Check is a guided workflow that checks every labware on the deck for an added degree of precision in your protocol.'
)
getByText(
'When you check a labware, the OT-2’s pipette nozzle or attached tip will stop at the center of the A1 well. If the pipette nozzle or tip is not centered, you can reveal the OT-2’s jog controls to make an adjustment. This Labware Offset will be applied to the entire labware. Offset data is measured to the nearest 1/10th mm and can be made in the X, Y and/or Z directions.'
)
getByText('Mock Position Check Nav')
})
})

0 comments on commit 914f5cc

Please sign in to comment.