mirror of
https://gitee.com/ByteDance/flowgram.ai.git
synced 2025-07-07 17:43:29 +08:00
test(canvas-core): fix ci test failed
This commit is contained in:
parent
d1c175e840
commit
429164671e
@ -56,12 +56,12 @@ describe('use-node-render', () => {
|
||||
const { result } = renderHook(() => useNodeRender(), {
|
||||
wrapper,
|
||||
});
|
||||
result.current.selectNode(new MouseEvent('click', { metaKey: true }) as any);
|
||||
result.current.selectNode(new MouseEvent('click', { shiftKey: true }) as any);
|
||||
const { result: result2 } = renderHook(() => useNodeRender(), {
|
||||
wrapper,
|
||||
});
|
||||
expect(result2.current.selected).toEqual(true);
|
||||
result.current.selectNode(new MouseEvent('click', { metaKey: true }) as any);
|
||||
result.current.selectNode(new MouseEvent('click', { shiftKey: true }) as any);
|
||||
const { result: result3 } = renderHook(() => useNodeRender(), {
|
||||
wrapper,
|
||||
});
|
||||
@ -98,7 +98,7 @@ describe('use-node-render', () => {
|
||||
});
|
||||
expect(result2.current.selected).toEqual(true);
|
||||
expect(node.getData(PositionData).toJSON()).toEqual({ x: 100, y: 100 });
|
||||
result.current.selectNode(new MouseEvent('click', { metaKey: true }) as any);
|
||||
result.current.selectNode(new MouseEvent('click', { shiftKey: true }) as any);
|
||||
const { result: result3 } = renderHook(() => useNodeRender(), {
|
||||
wrapper,
|
||||
});
|
||||
@ -115,7 +115,7 @@ describe('use-node-render', () => {
|
||||
);
|
||||
await delay(10);
|
||||
// 拖拽结束可以取消选中
|
||||
result.current.selectNode(new MouseEvent('click', { metaKey: true }) as any);
|
||||
result.current.selectNode(new MouseEvent('click', { shiftKey: true }) as any);
|
||||
expect(result.current.selected).toEqual(false);
|
||||
});
|
||||
it('start drag input', async () => {
|
||||
|
||||
@ -163,6 +163,7 @@ export function createSubCanvasNodes(document: WorkflowDocument) {
|
||||
id: 'subCanvas_0',
|
||||
type: FlowNodeBaseType.SUB_CANVAS,
|
||||
meta: {
|
||||
isContainer: true,
|
||||
position: { x: 100, y: 0 },
|
||||
subCanvas: () => ({
|
||||
isCanvas: true,
|
||||
|
||||
@ -205,6 +205,7 @@ describe('workflow-drag-service', () => {
|
||||
id: 'sub_canvas_0',
|
||||
type: FlowNodeBaseType.SUB_CANVAS,
|
||||
meta: {
|
||||
isContainer: true,
|
||||
position: {
|
||||
x: 0,
|
||||
y: 0,
|
||||
@ -506,6 +507,7 @@ describe('workflow-drag-service', () => {
|
||||
id: 'sub_canvas_0',
|
||||
type: FlowNodeBaseType.SUB_CANVAS,
|
||||
meta: {
|
||||
isContainer: true,
|
||||
position: { x: 0, y: -500 },
|
||||
size: { width: 1000, height: 1000 },
|
||||
selectable: true,
|
||||
|
||||
@ -177,6 +177,7 @@ describe('workflow-document', () => {
|
||||
id: 'sun_canvas_0',
|
||||
type: FlowNodeBaseType.SUB_CANVAS,
|
||||
meta: {
|
||||
isContainer: true,
|
||||
position: { x: 10, y: 10 },
|
||||
},
|
||||
blocks: [
|
||||
@ -499,6 +500,7 @@ describe('workflow-document with nestedJSON & subCanvas', () => {
|
||||
id: 'subCanvas_0',
|
||||
type: FlowNodeBaseType.SUB_CANVAS,
|
||||
meta: {
|
||||
isContainer: true,
|
||||
position: { x: 100, y: 0 },
|
||||
subCanvas: () => ({
|
||||
isCanvas: true,
|
||||
|
||||
@ -160,9 +160,6 @@ export class WorkflowDocument extends FlowDocument {
|
||||
): WorkflowNodeEntity {
|
||||
// 是否是一个已经存在的节点
|
||||
const isExistedNode = this.getNode(json.id);
|
||||
if (isExistedNode) {
|
||||
return isExistedNode;
|
||||
}
|
||||
const parent = this.getNode(parentId ?? this.root.id) ?? this.root;
|
||||
const node = this.addNode(
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user