mirror of
https://github.com/ant-design/ant-design.git
synced 2025-01-18 22:36:31 +08:00
fix(Tree): DraggableFn params type (#36648)
* fix(Tree): DraggableFn params type * chore: add blank line * test: add typ test for draggable Fn * test: add typ test for draggable Fn Co-authored-by: tianyuan233 <zty.dev@outlook.com>
This commit is contained in:
parent
ad7df07680
commit
09de419253
@ -95,7 +95,8 @@ export interface AntTreeNodeDropEvent {
|
||||
// [Legacy] Compatible for v3
|
||||
export type TreeNodeNormal = DataNode;
|
||||
|
||||
type DraggableFn = (node: AntTreeNode) => boolean;
|
||||
type DraggableFn = (node: DataNode) => boolean;
|
||||
|
||||
interface DraggableConfig {
|
||||
icon?: React.ReactNode | false;
|
||||
nodeDraggable?: DraggableFn;
|
||||
|
@ -1,6 +1,7 @@
|
||||
import type { BasicDataNode } from 'rc-tree';
|
||||
import * as React from 'react';
|
||||
import { render } from '../../../tests/utils';
|
||||
import type { DataNode } from '../index';
|
||||
import Tree from '../index';
|
||||
|
||||
const { DirectoryTree } = Tree;
|
||||
@ -74,4 +75,25 @@ describe('Tree.TypeScript', () => {
|
||||
|
||||
expect(container).toBeTruthy();
|
||||
});
|
||||
|
||||
it('draggable params type', () => {
|
||||
const { container } = render(
|
||||
<Tree
|
||||
treeData={[
|
||||
{
|
||||
title: 'Bamboo',
|
||||
key: 'bamboo',
|
||||
children: [
|
||||
{
|
||||
title: 'Little',
|
||||
key: 'little',
|
||||
},
|
||||
],
|
||||
},
|
||||
]}
|
||||
draggable={(node: DataNode) => node.title === 'Little'}
|
||||
/>,
|
||||
);
|
||||
expect(container).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user