mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-11-30 11:08:45 +08:00
fix(#19132): add test file
This commit is contained in:
parent
a0851cdd34
commit
e161a2ae76
@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
import { mount } from 'enzyme';
|
||||
import Tree from '../index';
|
||||
import { calcRangeKeys } from '../util';
|
||||
import { calcRangeKeys, getFullKeyListByTreeData } from '../util';
|
||||
|
||||
const { TreeNode } = Tree;
|
||||
|
||||
@ -32,4 +32,51 @@ describe('Tree util', () => {
|
||||
const target = ['0-0-0', '0-0-1', '0-1', '0-2', '0-2-0', '0-2-0-0', '0-2-0-1'];
|
||||
expect(keys.sort()).toEqual(target.sort());
|
||||
});
|
||||
|
||||
it('calc range keys by treeData', () => {
|
||||
const treeData = [
|
||||
{
|
||||
key: '0-0-0',
|
||||
title: 'Folder',
|
||||
children: [
|
||||
{
|
||||
title: 'Folder2',
|
||||
key: '0-0-1',
|
||||
children: [
|
||||
{
|
||||
title: 'File',
|
||||
key: '0-0-2',
|
||||
isLeaf: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
key: '0-0-3',
|
||||
title: 'Folder',
|
||||
children: [
|
||||
{
|
||||
title: 'File',
|
||||
key: '0-0-4',
|
||||
isLeaf: true,
|
||||
},
|
||||
{
|
||||
title: 'File',
|
||||
key: '0-0-5',
|
||||
isLeaf: true,
|
||||
},
|
||||
{
|
||||
title: 'File',
|
||||
key: '0-0-6',
|
||||
isLeaf: true,
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
const keys = getFullKeyListByTreeData(treeData);
|
||||
const target = ['0-0-0', '0-0-1', '0-0-2', '0-0-3', '0-0-4', '0-0-5', '0-0-6'];
|
||||
expect(keys.sort()).toEqual(target.sort());
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user