Skip to content

Commit

Permalink
update test to check PositionField component
Browse files Browse the repository at this point in the history
  • Loading branch information
shiyaochen authored and shiyaochen committed Feb 10, 2025
1 parent 1649f3a commit d808780
Showing 1 changed file with 4 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { COLORS } from '@opentrons/components'
import { fireEvent, screen } from '@testing-library/react'
import { i18n } from '../../../../../../../assets/localization'
import { renderWithProviders } from '../../../../../../../__testing-utils__'
import { PositionField } from '../../../PipetteFields'
import { MultiInputField } from '../MultiInputField'

import type { ComponentProps } from 'react'
Expand Down Expand Up @@ -54,35 +55,9 @@ describe('MultiInputField', () => {
updateValue: vi.fn(),
value: '',
},
aspirate_retract_mmFromBottom: {
onFieldFocus: vi.fn(),
onFieldBlur: vi.fn(),
errorToShow: null,
disabled: false,
name: 'aspirate_retract_mmFromBottom',
updateValue: vi.fn(),
value: null,
},
aspirate_retract_x_position: {
onFieldFocus: vi.fn(),
onFieldBlur: vi.fn(),
errorToShow: null,
disabled: false,
name: 'aspirate_retract_mmFromBottom',
updateValue: vi.fn(),
value: 0,
},
aspirate_retract_y_position: {
onFieldFocus: vi.fn(),
onFieldBlur: vi.fn(),
errorToShow: null,
disabled: false,
name: 'aspirate_retract_mmFromBottom',
updateValue: vi.fn(),
value: 0,
},
},
}
vi.mocked(PositionField).mockReturnValue(<div>mock PositionField</div>)
})

it('should render input fields with caption and units wrapped by ListItem', () => {
Expand All @@ -108,11 +83,10 @@ describe('MultiInputField', () => {
).toHaveBeenCalled()
})

it('should render a well position listbutton when isWellPosition is true', () => {
it('should render a well position component when isWellPosition is true', () => {
props.isWellPosition = true
props.labwareId = 'mockID'
render(props)
const listButton = screen.getByTestId('ListButton_onColor')
expect(listButton).toHaveStyle(`backgroundColor: ${COLORS.white}`)
screen.getByText('mock PositionField')
})
})

0 comments on commit d808780

Please sign in to comment.