mirror of
https://gitee.com/ant-design-vue/ant-design-vue.git
synced 2024-12-15 17:31:43 +08:00
55 lines
1.3 KiB
JavaScript
55 lines
1.3 KiB
JavaScript
import { mount } from '@vue/test-utils'
|
|
import List from '..'
|
|
import Icon from '../../icon'
|
|
|
|
describe('List', () => {
|
|
it('renders empty loading', () => {
|
|
const loading = {
|
|
spinning: true,
|
|
}
|
|
const wrapper = mount(
|
|
{
|
|
render () {
|
|
return <List loading={loading} dataSource={[]} renderItem={() => <List.Item />} />
|
|
},
|
|
})
|
|
expect(wrapper.findAll('.ant-list-empty-text')).toHaveLength(0)
|
|
})
|
|
|
|
it('renders object loading', () => {
|
|
const loading = {
|
|
spinning: true,
|
|
}
|
|
const wrapper = mount(
|
|
{
|
|
render () {
|
|
return <List
|
|
loading={loading}
|
|
dataSource={[1]}
|
|
renderItem={() => <List.Item />}
|
|
/>
|
|
},
|
|
})
|
|
expect(wrapper.findAll('.ant-spin-spinning')).toHaveLength(1)
|
|
})
|
|
|
|
it('renders object loading with indicator', () => {
|
|
const wrapper = mount(
|
|
{
|
|
render () {
|
|
return <List
|
|
loading={{
|
|
spinning: true,
|
|
indicator: <Icon type='loading' style={{ fontSize: '24px' }} spin />,
|
|
}}
|
|
dataSource={[1]}
|
|
renderItem={() => <List.Item />}
|
|
/>
|
|
},
|
|
}
|
|
|
|
)
|
|
expect(wrapper.findAll('.anticon-loading')).toHaveLength(1)
|
|
})
|
|
})
|