Skip to content

Commit

Permalink
test(radio): Remove the uncheck tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lzcabrera committed Nov 30, 2017
1 parent 81c9f97 commit ee04b90
Showing 1 changed file with 6 additions and 20 deletions.
26 changes: 6 additions & 20 deletions src/components/Radio/__tests__/Radio.spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ describe('Radio', () => {
findFakeInnerRadio: () => radio.find('[data-testid="fake-inner-radio"]'),
findColoredLabel: () => radio.find(ColoredTextProvider),
check: () => findRadioElement().simulate('change', { target: { checked: true } }),
uncheck: () => findRadioElement().simulate('change', { target: { checked: false } }),
focus: (focusEvent = {}) => findRadioElement().simulate('focus', focusEvent),
blur: (blurEvent = {}) => findRadioElement().simulate('blur', blurEvent),
}
Expand Down Expand Up @@ -94,40 +93,27 @@ describe('Radio', () => {
expect(findFakeInnerRadio()).toHaveClassName('innerChecked')
})

it.skip('checks and unchecks when clicking', () => {
const { findRadioElement, findFakeRadio, check, uncheck } = doMount()
it('checks when clicking', () => {
const { findRadioElement, findFakeRadio, findFakeInnerRadio, check } = doMount()

check()

expect(findRadioElement()).toHaveProp('checked', true)
expect(findFakeRadio()).toHaveClassName('checked')
expect(findFakeRadio()).toContainReact(
<DecorativeIcon symbol="checkmark" size={16} variant="inverted" />
)

uncheck()

expect(findRadioElement()).toHaveProp('checked', false)
expect(findFakeRadio()).toHaveClassName('unchecked')
expect(findFakeRadio().find(DecorativeIcon)).toBeEmpty()
expect(findFakeInnerRadio()).toHaveClassName('innerChecked')
})

it.skip('notifies when it is checked or unchecked', () => {
it('notifies when it is checked', () => {
const onChangeMock = jest.fn()
const { check, uncheck } = doMount({ onChange: onChangeMock })
const { check } = doMount({ onChange: onChangeMock })

check()
expect(onChangeMock).toHaveBeenCalledWith(
expect.objectContaining({ target: { checked: true } })
)

uncheck()
expect(onChangeMock).toHaveBeenCalledWith(
expect.objectContaining({ target: { checked: false } })
)
})

it.skip('can receive a new value from a parent component', () => {
it('can receive a new value from a parent component', () => {
const { radio, findRadioElement } = doMount({ checked: false })

radio.setProps({ checked: true })
Expand Down

0 comments on commit ee04b90

Please sign in to comment.