ant-design/components/list/__tests__/loading.test.js
二货机器人 64b905e9bd
chore: Update @ant-design/icons deps (#19979)
* update icons deps

* update all icon ref

* fix lint

* update snapshot
2019-11-28 12:34:33 +08:00

41 lines
1.1 KiB
JavaScript

import React from 'react';
import { render } from 'enzyme';
import { LoadingOutlined } from '@ant-design/icons';
import List from '..';
describe('List', () => {
it('renders empty loading', () => {
const loading = {
spinning: true,
};
const wrapper = render(
<List loading={loading} dataSource={[]} renderItem={() => <List.Item />} />,
);
expect(wrapper.find('.ant-list-empty-text')).toHaveLength(0);
});
it('renders object loading', () => {
const loading = {
spinning: true,
};
const wrapper = render(
<List loading={loading} dataSource={[1]} renderItem={() => <List.Item />} />,
);
expect(wrapper.find('.ant-spin-spinning')).toHaveLength(1);
});
it('renders object loading with indicator', () => {
const antIcon = <LoadingOutlined style={{ fontSize: 24 }} spin />;
const loading = {
spinning: true,
indicator: antIcon,
};
const wrapper = render(
<List loading={loading} dataSource={[1]} renderItem={() => <List.Item />} />,
);
expect(wrapper.find('.anticon-loading')).toHaveLength(1);
});
});