mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-16 01:41:02 +08:00
30ac6bd4e4
* test: React StrictMode * test: fix Spin test * chore: wrapper enzyme * test: fix setState * test: more test cover * test: more test cover * test: more test cover * test: more test cover * test: more test cover * test: more test case * test: more test case * test: more test case * test: more test case * test: more test case * test: more test case * test: more test case * test: more test case * test: more test case * test: more test case * test: more test case * test: more test case * test: disable part of it * test: fix test & add placeholder * test: Use orign enzyme mount Co-authored-by: zombiej <smith3816@gmail.com>
66 lines
1.6 KiB
JavaScript
66 lines
1.6 KiB
JavaScript
import React from 'react';
|
|
import { mount } from 'enzyme';
|
|
import { render } from '../../../tests/utils';
|
|
import Transfer from '../index';
|
|
|
|
describe('Transfer.Customize', () => {
|
|
const errorSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
|
|
|
|
afterEach(() => {
|
|
errorSpy.mockReset();
|
|
});
|
|
|
|
afterAll(() => {
|
|
errorSpy.mockRestore();
|
|
});
|
|
|
|
it('props#body does not work anymore', () => {
|
|
const body = jest.fn();
|
|
render(<Transfer body={body} />);
|
|
|
|
expect(errorSpy).not.toHaveBeenCalled();
|
|
expect(body).not.toHaveBeenCalled();
|
|
});
|
|
|
|
describe('deprecated function', () => {
|
|
const dataSource = [];
|
|
for (let i = 0; i < 10; i += 1) {
|
|
dataSource.push({
|
|
key: i.toString(),
|
|
});
|
|
}
|
|
const commonProps = {
|
|
dataSource,
|
|
selectedKeys: ['1'],
|
|
targetKeys: ['2'],
|
|
};
|
|
|
|
it('should not exist in render props', () => {
|
|
mount(
|
|
<Transfer {...commonProps}>
|
|
{props => {
|
|
expect('handleFilter' in props).toBeFalsy();
|
|
expect('handleSelect' in props).toBeFalsy();
|
|
expect('handleSelectAll' in props).toBeFalsy();
|
|
expect('handleClear' in props).toBeFalsy();
|
|
expect('body' in props).toBeFalsy();
|
|
expect('checkedKeys' in props).toBeFalsy();
|
|
}}
|
|
</Transfer>,
|
|
);
|
|
});
|
|
});
|
|
|
|
it('warning if use `pagination`', () => {
|
|
mount(
|
|
<Transfer dataSource={[]} pagination>
|
|
{() => null}
|
|
</Transfer>,
|
|
);
|
|
|
|
expect(errorSpy).toHaveBeenCalledWith(
|
|
'Warning: [antd: Transfer] `pagination` not support customize render list.',
|
|
);
|
|
});
|
|
});
|