mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-25 19:50:05 +08:00
eac30ec8e4
* feat: remove warnings for linkRender, nameRender in Breadcrumb * feat: remove warnings for onOpen, onClose in Menu * feat: remove warnings for overlay in Popover * feat: remove warnings for columnsPageRange, columnsPageSize in Table * feat: remove warnings for afterClose in Tag * feat: remove warnings for notFoundContent, searchPlaceholder, body, onSearchChange in Transfer * fix: types in Transfer * feat: update test cases in Transfer * feat: add additional test cases for removed deprecated apis
53 lines
1.3 KiB
JavaScript
53 lines
1.3 KiB
JavaScript
import React from 'react';
|
|
import { mount } from 'enzyme';
|
|
import Transfer from '../index';
|
|
|
|
describe('Transfer.Customize', () => {
|
|
const errorSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
|
|
|
|
afterEach(() => {
|
|
errorSpy.mockReset();
|
|
});
|
|
|
|
afterAll(() => {
|
|
errorSpy.mockRestore();
|
|
});
|
|
|
|
it('props#body doesnot work anymore', () => {
|
|
const body = jest.fn();
|
|
mount(<Transfer body={body} />);
|
|
|
|
expect(errorSpy.mock.calls.length).toBe(0);
|
|
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>,
|
|
);
|
|
});
|
|
});
|
|
});
|