Skip to content

Commit

Permalink
test(Form): props override context
Browse files Browse the repository at this point in the history
  • Loading branch information
guoyunhe committed Apr 18, 2024
1 parent 970fd7e commit bee6535
Showing 1 changed file with 32 additions and 1 deletion.
33 changes: 32 additions & 1 deletion src/components/form/tests/form.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ describe('Form', () => {
expect(baseElement.querySelector('.antd-mobile-icon')).toBeTruthy()
})

it('custom', () => {
it('props', () => {
render(
<Form>
<Form.Item
Expand Down Expand Up @@ -397,6 +397,25 @@ describe('Form', () => {

expect(screen.getByText('little')).toBeVisible()
})

it('props override context', () => {
render(
<ConfigProvider form={{ helpIcon: 'little' }}>
<Form>
<Form.Item
name='name'
label='name'
help='hello world'
helpIcon='bamboo'
>
<Input />
</Form.Item>
</Form>
</ConfigProvider>
)

expect(screen.getByText('bamboo')).toBeVisible()
})
})

describe('arrow', () => {
Expand Down Expand Up @@ -440,5 +459,17 @@ describe('Form', () => {

expect(screen.getByText('little')).toBeVisible()
})

it('context', () => {
render(
<ConfigProvider list={{ arrowIcon: 'little' }}>
<Form>
<Form.Item clickable arrowIcon='bamboo' />
</Form>
</ConfigProvider>
)

expect(screen.getByText('bamboo')).toBeVisible()
})
})
})

0 comments on commit bee6535

Please sign in to comment.