You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.2 KiB
39 lines
1.2 KiB
5 years ago
|
import { LoadingOutlined } from '@ant-design/icons';
|
||
2 years ago
|
import React from 'react';
|
||
3 years ago
|
import { render } from '../../../tests/utils';
|
||
5 years ago
|
|
||
7 years ago
|
import List from '..';
|
||
|
|
||
|
describe('List', () => {
|
||
|
it('renders empty loading', () => {
|
||
2 years ago
|
const loading = { spinning: true };
|
||
3 years ago
|
const { container: wrapper } = render(
|
||
6 years ago
|
<List loading={loading} dataSource={[]} renderItem={() => <List.Item />} />,
|
||
7 years ago
|
);
|
||
3 years ago
|
expect(wrapper.querySelectorAll('.ant-list-empty-text')).toHaveLength(0);
|
||
7 years ago
|
});
|
||
|
|
||
|
it('renders object loading', () => {
|
||
|
const loading = {
|
||
|
spinning: true,
|
||
|
};
|
||
3 years ago
|
const { container: wrapper } = render(
|
||
6 years ago
|
<List loading={loading} dataSource={[1]} renderItem={() => <List.Item />} />,
|
||
7 years ago
|
);
|
||
3 years ago
|
expect(wrapper.querySelectorAll('.ant-spin-spinning')).toHaveLength(1);
|
||
7 years ago
|
});
|
||
|
|
||
|
it('renders object loading with indicator', () => {
|
||
5 years ago
|
const antIcon = <LoadingOutlined style={{ fontSize: 24 }} spin />;
|
||
7 years ago
|
|
||
|
const loading = {
|
||
|
spinning: true,
|
||
|
indicator: antIcon,
|
||
|
};
|
||
3 years ago
|
const { container: wrapper } = render(
|
||
6 years ago
|
<List loading={loading} dataSource={[1]} renderItem={() => <List.Item />} />,
|
||
7 years ago
|
);
|
||
3 years ago
|
expect(wrapper.querySelectorAll('.anticon-loading')).toHaveLength(1);
|
||
7 years ago
|
});
|
||
|
});
|