mirror of
https://github.com/ant-design/ant-design.git
synced 2025-08-05 23:46:28 +08:00
✅ increase Table test coverage
This commit is contained in:
parent
fb913f4f47
commit
916c0659bd
@ -70,6 +70,15 @@ describe('Table.pagination', () => {
|
||||
expect(renderedNames(wrapper)).toEqual(['Jack']);
|
||||
});
|
||||
|
||||
it('should accept pagination size', () => {
|
||||
const wrapper = mount(
|
||||
createTable({
|
||||
pagination: { size: 'small' },
|
||||
}),
|
||||
);
|
||||
expect(wrapper.find('.ant-pagination.mini')).toHaveLength(1);
|
||||
});
|
||||
|
||||
// TODO
|
||||
it('should scroll to first row when page change', () => {
|
||||
const wrapper = mount(createTable({ scroll: { y: 20 } }));
|
||||
|
@ -630,4 +630,48 @@ describe('Table.sorter', () => {
|
||||
wrapper.find('th').simulate('click');
|
||||
expect(onClick).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('could sort data with children', () => {
|
||||
const wrapper = mount(
|
||||
createTable(
|
||||
{
|
||||
dataSource: [
|
||||
{
|
||||
key: '1',
|
||||
name: 'Brown',
|
||||
children: [
|
||||
{
|
||||
key: '2',
|
||||
name: 'Zoe',
|
||||
},
|
||||
{
|
||||
key: '3',
|
||||
name: 'Mike',
|
||||
children: [
|
||||
{
|
||||
key: '3-1',
|
||||
name: 'Petter',
|
||||
},
|
||||
{
|
||||
key: '3-2',
|
||||
name: 'Alex',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
key: '4',
|
||||
name: 'Green',
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
defaultSortOrder: 'ascend',
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
expect(renderedNames(wrapper)).toEqual(['Brown', 'Green', 'Mike', 'Alex', 'Petter', 'Zoe']);
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user