/* eslint-disable function-paren-newline, comma-dangle */ import React from 'react' import renderWithTheme from '../../testHelper' import RadioGroupWithNSupFields from '../RadioGroupWithNSupFields' describe('RadioGroupWithNSupFields', () => { it('renders a RadioGroupWithNSupFields', () => { const tree = renderWithTheme( (
I am a the A supplemental field!
) }, { index: 1, showSupplementalValue: '2', render: () => (
I am a the B supplemental field!
) }, ]} /> ) expect(tree).toMatchSnapshot() }) describe('events', () => { it('handles onChange', () => { const wrapper = mount( (
I am a the A supplemental field!
) }, { index: 1, showSupplementalValue: '2', render: () => (
I am a the B supplemental field!
) }, ]} /> ) const radio = wrapper.find('input#test-radio-with-sup-One') radio.simulate('change', { target: { checked: true, value: '1' } }) expect(wrapper.state('showingSupplementals')).toEqual([ expect.objectContaining({ index: 0, showSupplementalValue: '1' }) ]) radio.simulate('change', { target: { checked: true, value: '2' } }) expect(wrapper.state('showingSupplementals')).toEqual([ expect.objectContaining({ index: 1, showSupplementalValue: '2' }) ]) }) }) })