/* eslint-disable function-paren-newline, comma-dangle */ import React from 'react' import renderWithTheme from '../../testHelper' import CollapsableFormHeading from '../CollapsableFormHeading' describe('CollapsableFormHeading', () => { it('renders a closed CollapsableFormHeading', () => { const tree = renderWithTheme( (
Surprise! Hidden content!
)} /> ) expect(tree).toMatchSnapshot() }) it('renders an open CollapsableFormHeading by default', () => { const tree = renderWithTheme( (
Surprise! Hidden content!
)} /> ) expect(tree).toMatchSnapshot() }) it('renders an open CollapsableFormHeading', () => { const tree = mount( (
Surprise! Hidden content!
)} /> ) const heading = tree.find('div[data-test-id="form-heading"]') heading.simulate('click', { }) expect(tree).toMatchSnapshot() }) describe('events', () => { it('handles onClick', () => { const wrapper = mount( (
Surprise! Hidden content!
)} /> ) const heading = wrapper.find('div[data-test-id="form-heading"]') heading.simulate('click', { }) expect(wrapper.state('showRenderProps')).toEqual(true) heading.simulate('click', {}) expect(wrapper.state('showRenderProps')).toEqual(false) }) }) })