diff --git a/components/button-group/__tests__/__snapshots__/index.test.tsx.snap b/components/button-group/__tests__/__snapshots__/index.test.tsx.snap new file mode 100644 index 0000000..ae8ca85 --- /dev/null +++ b/components/button-group/__tests__/__snapshots__/index.test.tsx.snap @@ -0,0 +1,493 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`ButtonGroup buttons should be displayed vertically 1`] = ` +"
" +`; + +exports[`ButtonGroup props should be passed to each button 1`] = ` +"
" +`; + +exports[`ButtonGroup props should be passed to each button 2`] = ` +"
" +`; + +exports[`ButtonGroup should render correctly 1`] = ` +"
" +`; diff --git a/components/button-group/__tests__/index.test.tsx b/components/button-group/__tests__/index.test.tsx new file mode 100644 index 0000000..d85eda9 --- /dev/null +++ b/components/button-group/__tests__/index.test.tsx @@ -0,0 +1,53 @@ +import React from 'react' +import { mount } from 'enzyme' +import { ButtonGroup, Button } from 'components' +import { nativeEvent } from 'tests/utils' + +describe('ButtonGroup', () => { + it('should render correctly', () => { + const wrapper = mount( + + + , + ) + expect(wrapper.html()).toMatchSnapshot() + expect(() => wrapper.unmount()).not.toThrow() + }) + + it('props should be passed to each button', () => { + const wrapper = mount( + + + , + ) + expect(wrapper.html()).toMatchSnapshot() + wrapper.setProps({ ghost: true }) + expect(wrapper.html()).toMatchSnapshot() + expect(() => wrapper.unmount()).not.toThrow() + }) + + it('should ignore events when group disabled', () => { + const handler = jest.fn() + const wrapper = mount( + + + , + ) + wrapper.find('button').simulate('click', nativeEvent) + expect(handler).toHaveBeenCalledTimes(1) + wrapper.setProps({ disabled: true }) + wrapper.find('button').simulate('click', nativeEvent) + expect(handler).toHaveBeenCalledTimes(1) + }) + + it('buttons should be displayed vertically', () => { + const wrapper = mount( + + + + , + ) + expect(wrapper.html()).toMatchSnapshot() + expect(() => wrapper.unmount()).not.toThrow() + }) +}) diff --git a/components/button/__tests__/__snapshots__/icon.test.tsx.snap b/components/button/__tests__/__snapshots__/icon.test.tsx.snap index 07c3288..cdaf903 100644 --- a/components/button/__tests__/__snapshots__/icon.test.tsx.snap +++ b/components/button/__tests__/__snapshots__/icon.test.tsx.snap @@ -1,7 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`ButtonIcon should render correctly 1`] = ` -"