mirror of
https://github.com/zhigang1992/react.git
synced 2026-01-31 09:08:41 +08:00
* feat(scaleable): add scaleable props to each component * chore(scaleable): update the exported type * feat: apply scaleable to components chore: remove with-default test: improve testcase for scaleable chore: resolve test warning ci: upgrade nodejs to latest lts docs: fix type error in document site * docs: update documents to be compatible with scaleable chore: fix build errors * chore: remove all size-related attributes docs: improve guide document * docs: add scaleable documentation test: update snapshots chore: remove unused * feat: add scaleable to grid components * docs: improve docs * test: update snapshots * fix(grid): fix basic component props
42 lines
1.1 KiB
TypeScript
42 lines
1.1 KiB
TypeScript
import React from 'react'
|
|
import { mount } from 'enzyme'
|
|
import { Loading } from 'components'
|
|
|
|
describe('Loading', () => {
|
|
it('should render correctly', () => {
|
|
const wrapper = mount(<Loading />)
|
|
expect(wrapper.html()).toMatchSnapshot()
|
|
expect(() => wrapper.unmount()).toMatchSnapshot()
|
|
})
|
|
|
|
it('should work with different types', () => {
|
|
const wrapper = mount(
|
|
<div>
|
|
<Loading type="success" />
|
|
<Loading type="secondary" />
|
|
<Loading type="warning" />
|
|
<Loading type="error" />
|
|
</div>,
|
|
)
|
|
expect(wrapper.html()).toMatchSnapshot()
|
|
expect(() => wrapper.unmount()).toMatchSnapshot()
|
|
})
|
|
|
|
it('should work with custom styles', () => {
|
|
const wrapper = mount(
|
|
<div>
|
|
<Loading color="#fff" />
|
|
<Loading unit="20%" />
|
|
<Loading unit="10px" />
|
|
</div>,
|
|
)
|
|
expect(wrapper.html()).toMatchSnapshot()
|
|
expect(() => wrapper.unmount()).toMatchSnapshot()
|
|
})
|
|
|
|
it('should work with children', () => {
|
|
const wrapper = mount(<Loading>test-children</Loading>)
|
|
expect(wrapper.find('.loading').text()).toContain('test-children')
|
|
})
|
|
})
|