mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-05 05:28:20 +08:00
36 lines
864 B
JavaScript
36 lines
864 B
JavaScript
import React from 'react';
|
|
import { render, mount } from 'enzyme';
|
|
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(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();
|
|
});
|
|
});
|