Skip to content

Commit c905017

Browse files
committed
test(radio-group): enhance test case about the disabled prop
1 parent fc03409 commit c905017

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

packages/bezier-react/src/components/Forms/RadioGroup/RadioGroup.test.tsx

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,17 @@ describe('RadioGroup', () => {
5353
const { getByRole } = renderRadioGroup({ radioGroupProps: { required: true } })
5454
expect(getByRole('radiogroup')).toBeRequired()
5555
})
56+
57+
it('should be disabled when disabled prop is true', () => {
58+
const { getByRole } = renderRadioGroup({ radioGroupProps: { disabled: true } })
59+
expect(getByRole('radiogroup')).toHaveAttribute('aria-disabled', 'true')
60+
})
61+
62+
it('children(Radio) should be disabled when disabled prop is true', () => {
63+
const { getAllByRole } = renderRadioGroup({ radioGroupProps: { disabled: true } })
64+
const radios = getAllByRole('radio')
65+
radios.forEach(radio => expect(radio).toBeDisabled())
66+
})
5667
})
5768

5869
describe('User Interactions', () => {
@@ -151,12 +162,6 @@ describe('RadioGroup', () => {
151162
const radios = getAllByRole('radio')
152163
radios.forEach(radio => expect(radio).toBeDisabled())
153164
})
154-
155-
it('should be disabled when disabled prop of RadioGroup is true', () => {
156-
const { getAllByRole } = renderRadioGroup({ radioGroupProps: { disabled: false }, radioProps: { disabled: true } })
157-
const radios = getAllByRole('radio')
158-
radios.forEach(radio => expect(radio).toBeDisabled())
159-
})
160165
})
161166
})
162167
})

0 commit comments

Comments
 (0)