mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-23 06:58:33 +08:00
8f81594f91
* refactor: extract injectLocale and refactor Pagination, ref: #5103 * refactor: use injectLocale in Popconfirm, ref: #5103 * refactor: use injectLocale in TimePicker * refactor: use injectLocale in Transfer * refactor: use injectLocale in TreeSelect * refactor: remove useless code in AutoComplete * test: update snapshot
37 lines
925 B
JavaScript
37 lines
925 B
JavaScript
import React from 'react';
|
|
import { render, mount } from 'enzyme';
|
|
import { renderToJson } from 'enzyme-to-json';
|
|
import List from '../list';
|
|
import Checkbox from '../../checkbox';
|
|
|
|
const listCommonProps = {
|
|
prefixCls: 'ant-transfer-list',
|
|
dataSource: [{
|
|
key: 'a',
|
|
title: 'a',
|
|
}, {
|
|
key: 'b',
|
|
title: 'b',
|
|
}, {
|
|
key: 'c',
|
|
title: 'c',
|
|
disabled: true,
|
|
}],
|
|
checkedKeys: ['a'],
|
|
notFoundContent: 'Not Found',
|
|
lazy: false,
|
|
};
|
|
|
|
describe('List', () => {
|
|
it('should render correctly', () => {
|
|
const wrapper = render(<List {...listCommonProps} />);
|
|
expect(renderToJson(wrapper)).toMatchSnapshot();
|
|
});
|
|
|
|
it('should check top Checkbox while all available items are checked', () => {
|
|
const wrapper = mount(<List {...listCommonProps} checkedKeys={['a', 'b']} />);
|
|
expect(wrapper.find('.ant-transfer-list-header').find(Checkbox).prop('checked'))
|
|
.toBeTruthy();
|
|
});
|
|
});
|