parent
e7ab83cd86
commit
6aa8d3effd
@ -0,0 +1,3 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`List renders empty list 1`] = `<div class="ant-list ant-list-split"><span tag="div" class="ant-spin-nested-loading"><div class="ant-spin-container"><div class="ant-list-empty-text">No data</div></div></span></div>`;
|
@ -0,0 +1,13 @@
|
||||
import { mount } from '@vue/test-utils'
|
||||
import List from '..'
|
||||
|
||||
describe('List', () => {
|
||||
it('renders empty list', () => {
|
||||
const wrapper = mount({
|
||||
render () {
|
||||
return <List dataSource={[]} renderItem={() => <List.Item />} />
|
||||
},
|
||||
})
|
||||
expect(wrapper.html()).toMatchSnapshot()
|
||||
})
|
||||
})
|
@ -0,0 +1,55 @@
|
||||
import { mount } from '@vue/test-utils'
|
||||
import { asyncExpect } from '@/tests/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)
|
||||
})
|
||||
})
|
@ -0,0 +1,8 @@
|
||||
<script>
|
||||
import List from '..'
|
||||
export default {
|
||||
render () {
|
||||
return <List dataSource={[]} renderItem={() => <List.Item />} />
|
||||
},
|
||||
}
|
||||
</script>
|
Loading…
Reference in new issue