File size: 1,014 Bytes
1e92f2d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
import React from 'react';
import RenderEmpty from '../defaultRenderEmpty';
import { render } from '../../../tests/utils';
describe('renderEmpty', () => {
it.each([
'Table',
'Table.filter' /* 👈 5.19.0+ */,
'List',
'Select',
'TreeSelect',
'Cascader',
'Transfer',
'Mentions',
])('should render %s empty', (componentName: any) => {
const { container } = render(<RenderEmpty componentName={componentName} />);
expect(container.firstChild).toMatchSnapshot();
});
// https://github.com/ant-design/ant-design/pull/49613#issuecomment-2198857047
it('should return false when componentName is `Table.filter`', () => {
const { container } = render(<RenderEmpty componentName="Table.filter" />);
expect(container.firstChild).toBeFalsy();
});
it('should return empty when componentName is not matched', () => {
const { container } = render(<RenderEmpty componentName={`not_match` as any} />);
expect(container.firstChild).toMatchSnapshot();
});
});
|