test(divider): add testcase

This commit is contained in:
unix
2020-04-18 14:15:26 +08:00
parent d720c363fc
commit e7eb13bddb
2 changed files with 4209 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,56 @@
import React from 'react'
import { mount, render } from 'enzyme'
import { Divider } from 'components'
describe('Divider', () => {
it('should render correctly', () => {
const wrapper = mount(<Divider />)
expect(wrapper).toMatchSnapshot()
expect(() => wrapper.unmount()).not.toThrow()
})
it('should work with x and y', () => {
const wrapper = render(
<div>
<Divider x={3} />
<Divider y={3} />
</div>
)
expect(wrapper).toMatchSnapshot()
})
it('should work with type', () => {
const wrapper = render(
<div>
<Divider type="secondary" />
<Divider type="warning" />
<Divider type="dark" />
</div>
)
expect(wrapper).toMatchSnapshot()
})
it('should work with align and volume', () => {
const wrapper = render(
<div>
<Divider align="start">start</Divider>
<Divider align="left">left</Divider>
<Divider align="end">end</Divider>
<Divider align="start" volume={2}>start</Divider>
</div>
)
expect(wrapper).toMatchSnapshot()
})
it('should support float', () => {
const wrapper = mount(
<div>
<Divider x={1.1} y={2.5} />
<Divider volume={2.5} />
</div>
)
expect(wrapper).toMatchSnapshot()
expect(() => wrapper.unmount()).not.toThrow()
})
})