ant-design-vue/components/list/__tests__/loading.test.js

48 lines
1.2 KiB
JavaScript
Raw Normal View History

2019-01-12 03:33:27 +00:00
import { mount } from '@vue/test-utils';
import List from '..';
import Icon from '../../icon';
2018-06-16 14:57:11 +00:00
describe('List', () => {
it('renders empty loading', () => {
const loading = {
spinning: true,
2019-01-12 03:33:27 +00:00
};
const wrapper = mount({
render() {
return <List loading={loading} dataSource={[]} renderItem={() => <List.Item />} />;
},
});
expect(wrapper.findAll('.ant-list-empty-text')).toHaveLength(0);
});
2018-06-16 14:57:11 +00:00
it('renders object loading', () => {
const loading = {
spinning: true,
2019-01-12 03:33:27 +00:00
};
const wrapper = mount({
render() {
return <List loading={loading} dataSource={[1]} renderItem={() => <List.Item />} />;
},
});
expect(wrapper.findAll('.ant-spin-spinning')).toHaveLength(1);
});
2018-06-16 14:57:11 +00:00
it('renders object loading with indicator', () => {
2019-01-12 03:33:27 +00:00
const wrapper = mount({
render() {
return (
<List
2018-06-16 14:57:11 +00:00
loading={{
spinning: true,
2019-01-12 03:33:27 +00:00
indicator: <Icon type="loading" style={{ fontSize: '24px' }} spin />,
2018-06-16 14:57:11 +00:00
}}
dataSource={[1]}
renderItem={() => <List.Item />}
/>
2019-01-12 03:33:27 +00:00
);
},
});
expect(wrapper.findAll('.anticon-loading')).toHaveLength(1);
});
});