mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-04 08:59:40 +08:00
8114516496
* update tree deps * add part of style * flex grid * update disabled * update demo * second demo * add draggable style * update demo * update rc-tree version * temp md * update tree deps * update icon demo * update style * update less * update deps * clean up * update test case * fix show line * update snapshot * fix lint * update style * update deps
21 lines
672 B
JavaScript
21 lines
672 B
JavaScript
import { calcRangeKeys } from '../util';
|
|
|
|
describe('Tree util', () => {
|
|
it('calc range keys', () => {
|
|
const treeData = [
|
|
{ key: '0-0', children: [{ key: '0-0-0' }, { key: '0-0-1' }] },
|
|
{ key: '0-1', children: [{ key: '0-1-0' }, { key: '0-1-1' }] },
|
|
{
|
|
key: '0-2',
|
|
children: [
|
|
{ key: '0-2-0', children: [{ key: '0-2-0-0' }, { key: '0-2-0-1' }, { key: '0-2-0-2' }] },
|
|
],
|
|
},
|
|
];
|
|
|
|
const keys = calcRangeKeys(treeData, ['0-0', '0-2', '0-2-0'], '0-2-0-1', '0-0-0');
|
|
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());
|
|
});
|
|
});
|