@yh-ui/flow 1.0.26 → 1.0.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. package/package.json +4 -4
  2. package/dist/__tests__/ai-workflow.ssr.test.cjs +0 -352
  3. package/dist/__tests__/ai-workflow.ssr.test.d.ts +0 -1
  4. package/dist/__tests__/ai-workflow.ssr.test.mjs +0 -283
  5. package/dist/__tests__/ai-workflow.test.cjs +0 -109
  6. package/dist/__tests__/ai-workflow.test.d.ts +0 -1
  7. package/dist/__tests__/ai-workflow.test.mjs +0 -112
  8. package/dist/__tests__/bpmn-engine.test.cjs +0 -357
  9. package/dist/__tests__/bpmn-engine.test.d.ts +0 -1
  10. package/dist/__tests__/bpmn-engine.test.mjs +0 -406
  11. package/dist/__tests__/bpmn-utils.test.cjs +0 -268
  12. package/dist/__tests__/bpmn-utils.test.d.ts +0 -1
  13. package/dist/__tests__/bpmn-utils.test.mjs +0 -227
  14. package/dist/__tests__/bpmn-xml.test.cjs +0 -150
  15. package/dist/__tests__/bpmn-xml.test.d.ts +0 -1
  16. package/dist/__tests__/bpmn-xml.test.mjs +0 -112
  17. package/dist/__tests__/bpmn.ssr.test.cjs +0 -278
  18. package/dist/__tests__/bpmn.ssr.test.d.ts +0 -1
  19. package/dist/__tests__/bpmn.ssr.test.mjs +0 -237
  20. package/dist/__tests__/bpmn.test.cjs +0 -103
  21. package/dist/__tests__/bpmn.test.d.ts +0 -1
  22. package/dist/__tests__/bpmn.test.mjs +0 -106
  23. package/dist/__tests__/collaboration.test.cjs +0 -487
  24. package/dist/__tests__/collaboration.test.d.ts +0 -1
  25. package/dist/__tests__/collaboration.test.mjs +0 -424
  26. package/dist/__tests__/custom-types.test.cjs +0 -300
  27. package/dist/__tests__/custom-types.test.d.ts +0 -1
  28. package/dist/__tests__/custom-types.test.mjs +0 -248
  29. package/dist/__tests__/edge-types.test.cjs +0 -275
  30. package/dist/__tests__/edge-types.test.d.ts +0 -1
  31. package/dist/__tests__/edge-types.test.mjs +0 -234
  32. package/dist/__tests__/edge-utils.test.cjs +0 -375
  33. package/dist/__tests__/edge-utils.test.d.ts +0 -1
  34. package/dist/__tests__/edge-utils.test.mjs +0 -376
  35. package/dist/__tests__/edge.test.cjs +0 -56
  36. package/dist/__tests__/edge.test.d.ts +0 -1
  37. package/dist/__tests__/edge.test.mjs +0 -69
  38. package/dist/__tests__/event-bus.test.cjs +0 -80
  39. package/dist/__tests__/event-bus.test.d.ts +0 -1
  40. package/dist/__tests__/event-bus.test.mjs +0 -51
  41. package/dist/__tests__/events-types.test.cjs +0 -184
  42. package/dist/__tests__/events-types.test.d.ts +0 -1
  43. package/dist/__tests__/events-types.test.mjs +0 -184
  44. package/dist/__tests__/export-image-plugin.test.cjs +0 -142
  45. package/dist/__tests__/export-image-plugin.test.d.ts +0 -1
  46. package/dist/__tests__/export-image-plugin.test.mjs +0 -118
  47. package/dist/__tests__/export.test.cjs +0 -237
  48. package/dist/__tests__/export.test.d.ts +0 -1
  49. package/dist/__tests__/export.test.mjs +0 -171
  50. package/dist/__tests__/flow-context.test.cjs +0 -16
  51. package/dist/__tests__/flow-context.test.d.ts +0 -1
  52. package/dist/__tests__/flow-context.test.mjs +0 -16
  53. package/dist/__tests__/flow-props.test.cjs +0 -94
  54. package/dist/__tests__/flow-props.test.d.ts +0 -1
  55. package/dist/__tests__/flow-props.test.mjs +0 -92
  56. package/dist/__tests__/flow.ssr.test.cjs +0 -156
  57. package/dist/__tests__/flow.ssr.test.d.ts +0 -1
  58. package/dist/__tests__/flow.ssr.test.mjs +0 -112
  59. package/dist/__tests__/geometry.test.cjs +0 -191
  60. package/dist/__tests__/geometry.test.d.ts +0 -1
  61. package/dist/__tests__/geometry.test.mjs +0 -105
  62. package/dist/__tests__/graph.test.cjs +0 -115
  63. package/dist/__tests__/graph.test.d.ts +0 -1
  64. package/dist/__tests__/graph.test.mjs +0 -85
  65. package/dist/__tests__/history-plugin.test.cjs +0 -191
  66. package/dist/__tests__/history-plugin.test.d.ts +0 -1
  67. package/dist/__tests__/history-plugin.test.mjs +0 -161
  68. package/dist/__tests__/history.test.cjs +0 -81
  69. package/dist/__tests__/history.test.d.ts +0 -1
  70. package/dist/__tests__/history.test.mjs +0 -43
  71. package/dist/__tests__/layout-plugin.test.cjs +0 -233
  72. package/dist/__tests__/layout-plugin.test.d.ts +0 -1
  73. package/dist/__tests__/layout-plugin.test.mjs +0 -215
  74. package/dist/__tests__/layout.test.cjs +0 -213
  75. package/dist/__tests__/layout.test.d.ts +0 -1
  76. package/dist/__tests__/layout.test.mjs +0 -170
  77. package/dist/__tests__/node-edit-panel.ssr.test.cjs +0 -168
  78. package/dist/__tests__/node-edit-panel.ssr.test.d.ts +0 -1
  79. package/dist/__tests__/node-edit-panel.ssr.test.mjs +0 -118
  80. package/dist/__tests__/node-group-plugin.test.cjs +0 -235
  81. package/dist/__tests__/node-group-plugin.test.d.ts +0 -1
  82. package/dist/__tests__/node-group-plugin.test.mjs +0 -187
  83. package/dist/__tests__/node-handles.test.cjs +0 -340
  84. package/dist/__tests__/node-handles.test.d.ts +0 -1
  85. package/dist/__tests__/node-handles.test.mjs +0 -230
  86. package/dist/__tests__/node-types.test.cjs +0 -368
  87. package/dist/__tests__/node-types.test.d.ts +0 -1
  88. package/dist/__tests__/node-types.test.mjs +0 -292
  89. package/dist/__tests__/performance.test.cjs +0 -313
  90. package/dist/__tests__/performance.test.d.ts +0 -1
  91. package/dist/__tests__/performance.test.mjs +0 -218
  92. package/dist/__tests__/plugin-advanced.test.cjs +0 -301
  93. package/dist/__tests__/plugin-advanced.test.d.ts +0 -1
  94. package/dist/__tests__/plugin-advanced.test.mjs +0 -225
  95. package/dist/__tests__/plugin.test.cjs +0 -151
  96. package/dist/__tests__/plugin.test.d.ts +0 -1
  97. package/dist/__tests__/plugin.test.mjs +0 -116
  98. package/dist/__tests__/plugins.test.cjs +0 -412
  99. package/dist/__tests__/plugins.test.d.ts +0 -1
  100. package/dist/__tests__/plugins.test.mjs +0 -402
  101. package/dist/__tests__/screenshot-capture.test.cjs +0 -183
  102. package/dist/__tests__/screenshot-capture.test.d.ts +0 -1
  103. package/dist/__tests__/screenshot-capture.test.mjs +0 -124
  104. package/dist/__tests__/screenshot.test.cjs +0 -74
  105. package/dist/__tests__/screenshot.test.d.ts +0 -1
  106. package/dist/__tests__/screenshot.test.mjs +0 -69
  107. package/dist/__tests__/theme.test.cjs +0 -185
  108. package/dist/__tests__/theme.test.d.ts +0 -1
  109. package/dist/__tests__/theme.test.mjs +0 -191
  110. package/dist/__tests__/transform.test.cjs +0 -384
  111. package/dist/__tests__/transform.test.d.ts +0 -1
  112. package/dist/__tests__/transform.test.mjs +0 -239
  113. package/dist/__tests__/useAlignment.test.cjs +0 -128
  114. package/dist/__tests__/useAlignment.test.d.ts +0 -1
  115. package/dist/__tests__/useAlignment.test.mjs +0 -72
  116. package/dist/__tests__/useEdges.test.cjs +0 -117
  117. package/dist/__tests__/useEdges.test.d.ts +0 -1
  118. package/dist/__tests__/useEdges.test.mjs +0 -80
  119. package/dist/__tests__/useKeyboard.test.cjs +0 -88
  120. package/dist/__tests__/useKeyboard.test.d.ts +0 -1
  121. package/dist/__tests__/useKeyboard.test.mjs +0 -56
  122. package/dist/__tests__/useNodeDistribution.test.cjs +0 -643
  123. package/dist/__tests__/useNodeDistribution.test.d.ts +0 -1
  124. package/dist/__tests__/useNodeDistribution.test.mjs +0 -297
  125. package/dist/__tests__/useNodes.test.cjs +0 -150
  126. package/dist/__tests__/useNodes.test.d.ts +0 -1
  127. package/dist/__tests__/useNodes.test.mjs +0 -80
  128. package/dist/__tests__/useSelection.test.cjs +0 -112
  129. package/dist/__tests__/useSelection.test.d.ts +0 -1
  130. package/dist/__tests__/useSelection.test.mjs +0 -76
  131. package/dist/__tests__/useViewport.test.cjs +0 -171
  132. package/dist/__tests__/useViewport.test.d.ts +0 -1
  133. package/dist/__tests__/useViewport.test.mjs +0 -82
  134. package/dist/__tests__/utils/ssr.cjs +0 -124
  135. package/dist/__tests__/utils/ssr.d.ts +0 -33
  136. package/dist/__tests__/utils/ssr.mjs +0 -129
  137. package/dist/__tests__/validation.test.cjs +0 -95
  138. package/dist/__tests__/validation.test.d.ts +0 -1
  139. package/dist/__tests__/validation.test.mjs +0 -36
  140. package/dist/__tests__/viewport-types.test.cjs +0 -324
  141. package/dist/__tests__/viewport-types.test.d.ts +0 -1
  142. package/dist/__tests__/viewport-types.test.mjs +0 -207
@@ -1,187 +0,0 @@
1
- import { describe, it, expect, vi } from "vitest";
2
- import { ref } from "vue";
3
- import { createNodeGroupPlugin } from "../plugins/plugins/node-group.mjs";
4
- function createMockFlow(initialNodes = [], initialEdges = []) {
5
- const nodes = ref(initialNodes);
6
- const edges = ref(initialEdges);
7
- const flow = {
8
- nodes,
9
- edges,
10
- viewport: ref({ x: 0, y: 0, zoom: 1 }),
11
- addNode: vi.fn((node) => {
12
- nodes.value = [...nodes.value, node];
13
- }),
14
- removeNode: vi.fn((id) => {
15
- nodes.value = nodes.value.filter((n) => n.id !== id);
16
- }),
17
- updateNode: vi.fn((id, data) => {
18
- nodes.value = nodes.value.map((n) => n.id === id ? { ...n, ...data } : n);
19
- }),
20
- getNode: vi.fn((id) => nodes.value.find((n) => n.id === id)),
21
- addEdge: vi.fn(),
22
- removeEdge: vi.fn(),
23
- updateEdge: vi.fn((id, data) => {
24
- edges.value = edges.value.map((e) => e.id === id ? { ...e, ...data } : e);
25
- }),
26
- getEdge: vi.fn(),
27
- setViewport: vi.fn(),
28
- fitView: vi.fn(),
29
- zoomIn: vi.fn(),
30
- zoomOut: vi.fn(),
31
- centerView: vi.fn(),
32
- selectNode: vi.fn(),
33
- selectEdge: vi.fn(),
34
- clearSelection: vi.fn(),
35
- getNodes: () => nodes.value,
36
- getEdges: () => edges.value,
37
- getViewport: () => ({ x: 0, y: 0, zoom: 1 }),
38
- screenToCanvas: vi.fn().mockReturnValue({ x: 0, y: 0 }),
39
- canvasToScreen: vi.fn().mockReturnValue({ x: 0, y: 0 }),
40
- on: vi.fn(),
41
- off: vi.fn(),
42
- emit: vi.fn(),
43
- isValidConnection: vi.fn().mockReturnValue(true),
44
- $el: void 0,
45
- draggingNodeId: ref(null),
46
- draggingPosition: ref(null),
47
- usePlugin: vi.fn(),
48
- removePlugin: vi.fn()
49
- };
50
- return flow;
51
- }
52
- describe("createNodeGroupPlugin", () => {
53
- it("should be created with correct metadata", () => {
54
- const plugin = createNodeGroupPlugin();
55
- expect(plugin.id).toBe("node-group");
56
- expect(plugin.name).toBe("NodeGroup");
57
- });
58
- it("should expose groupSelectedNodes on flow instance after install", () => {
59
- const flow = createMockFlow();
60
- const plugin = createNodeGroupPlugin();
61
- plugin.install(flow);
62
- expect(typeof flow.groupSelectedNodes).toBe("function");
63
- expect(typeof flow.ungroupNodes).toBe("function");
64
- expect(typeof flow.toggleGroupCollapse).toBe("function");
65
- expect(typeof flow.isGroupCollapsed).toBe("function");
66
- expect(typeof flow.getGroupChildren).toBe("function");
67
- expect(typeof flow.getGroupRegistry).toBe("function");
68
- });
69
- it("should return null when fewer than 2 nodes are selected", () => {
70
- const nodes = [
71
- { id: "1", type: "default", position: { x: 0, y: 0 }, data: {}, selected: true }
72
- ];
73
- const flow = createMockFlow(nodes);
74
- const plugin = createNodeGroupPlugin();
75
- plugin.install(flow);
76
- const result = flow.groupSelectedNodes;
77
- expect(result()).toBeNull();
78
- });
79
- it("should create a group node when 2+ nodes are selected", () => {
80
- const nodes = [
81
- {
82
- id: "1",
83
- type: "default",
84
- position: { x: 100, y: 100 },
85
- data: {},
86
- selected: true,
87
- width: 150,
88
- height: 50
89
- },
90
- {
91
- id: "2",
92
- type: "default",
93
- position: { x: 300, y: 100 },
94
- data: {},
95
- selected: true,
96
- width: 150,
97
- height: 50
98
- }
99
- ];
100
- const flow = createMockFlow(nodes);
101
- const plugin = createNodeGroupPlugin({ groupIdPrefix: "grp" });
102
- plugin.install(flow);
103
- const groupSelected = flow.groupSelectedNodes;
104
- const groupId = groupSelected("Test Group");
105
- expect(groupId).toBeTruthy();
106
- expect(groupId).toMatch(/^grp-/);
107
- expect(flow.addNode).toHaveBeenCalled();
108
- });
109
- it("should register group info in registry after grouping", () => {
110
- const nodes = [
111
- {
112
- id: "a",
113
- type: "default",
114
- position: { x: 50, y: 50 },
115
- data: {},
116
- selected: true,
117
- width: 100,
118
- height: 50
119
- },
120
- {
121
- id: "b",
122
- type: "default",
123
- position: { x: 200, y: 50 },
124
- data: {},
125
- selected: true,
126
- width: 100,
127
- height: 50
128
- }
129
- ];
130
- const flow = createMockFlow(nodes);
131
- const plugin = createNodeGroupPlugin();
132
- plugin.install(flow);
133
- const groupSelected = flow.groupSelectedNodes;
134
- const groupId = groupSelected();
135
- const registry = flow.getGroupRegistry();
136
- expect(registry.has(groupId)).toBe(true);
137
- });
138
- it("should toggle group collapse and hide children", () => {
139
- const childNodes = [
140
- {
141
- id: "c1",
142
- type: "default",
143
- position: { x: 20, y: 20 },
144
- data: {},
145
- parentId: "group-1",
146
- width: 100,
147
- height: 40
148
- }
149
- ];
150
- const flow = createMockFlow(childNodes);
151
- const plugin = createNodeGroupPlugin();
152
- plugin.install(flow);
153
- const registry = flow.getGroupRegistry();
154
- registry.set("group-1", {
155
- groupId: "group-1",
156
- childIds: ["c1"],
157
- collapsed: false,
158
- originalPositions: {}
159
- });
160
- flow.nodes.value.push({
161
- id: "group-1",
162
- type: "group",
163
- position: { x: 0, y: 0 },
164
- data: {},
165
- style: { width: 200, height: 150 },
166
- width: 200,
167
- height: 150
168
- });
169
- const toggleCollapse = flow.toggleGroupCollapse;
170
- toggleCollapse("group-1");
171
- expect(flow.updateNode).toHaveBeenCalledWith("c1", expect.objectContaining({ hidden: true }));
172
- });
173
- it("should cleanup registry on destroy", () => {
174
- const flow = createMockFlow();
175
- const plugin = createNodeGroupPlugin();
176
- plugin.install(flow);
177
- plugin.destroy?.();
178
- const registry = flow.getGroupRegistry();
179
- expect(registry.size).toBe(0);
180
- });
181
- it("should not install when disabled", () => {
182
- const flow = createMockFlow();
183
- const plugin = createNodeGroupPlugin({ enabled: false });
184
- plugin.install(flow);
185
- expect(flow.groupSelectedNodes).toBeUndefined();
186
- });
187
- });
@@ -1,340 +0,0 @@
1
- "use strict";
2
-
3
- var _vitest = require("vitest");
4
- const getHandles = (node, type) => {
5
- if (node.handleBounds) {
6
- const handles = [];
7
- if (node.handleBounds.top) handles.push(...node.handleBounds.top);
8
- if (node.handleBounds.right) handles.push(...node.handleBounds.right);
9
- if (node.handleBounds.bottom) handles.push(...node.handleBounds.bottom);
10
- if (node.handleBounds.left) handles.push(...node.handleBounds.left);
11
- return handles.filter(h => h.type === type);
12
- }
13
- if (node.type === "group") {
14
- return [];
15
- }
16
- if (node.type === "input") {
17
- return type === "source" ? [{
18
- type: "source",
19
- position: "right"
20
- }] : [];
21
- }
22
- if (node.type === "output") {
23
- return type === "target" ? [{
24
- type: "target",
25
- position: "left"
26
- }] : [];
27
- }
28
- if (node.type === "bpmn-start") {
29
- return type === "source" ? [{
30
- type: "source",
31
- position: "right"
32
- }] : [];
33
- }
34
- if (node.type === "bpmn-end") {
35
- return type === "target" ? [{
36
- type: "target",
37
- position: "left"
38
- }] : [];
39
- }
40
- if (node.type === "bpmn-task" || node.type === "bpmn-service-task" || node.type === "bpmn-user-task") {
41
- return [{
42
- type: "target",
43
- position: "left"
44
- }, {
45
- type: "source",
46
- position: "right"
47
- }].filter(h => h.type === type);
48
- }
49
- if (node.type === "bpmn-exclusive-gateway" || node.type === "bpmn-parallel-gateway" || node.type === "bpmn-inclusive-gateway") {
50
- return [{
51
- type: "target",
52
- position: "left"
53
- }, {
54
- type: "source",
55
- position: "right"
56
- }, {
57
- type: "target",
58
- position: "top"
59
- }, {
60
- type: "source",
61
- position: "bottom"
62
- }].filter(h => h.type === type);
63
- }
64
- if (node.type === "ai-start") {
65
- return type === "source" ? [{
66
- type: "source",
67
- position: "right"
68
- }] : [];
69
- }
70
- if (node.type === "ai-end") {
71
- return type === "target" ? [{
72
- type: "target",
73
- position: "left"
74
- }] : [];
75
- }
76
- if (node.type === "ai-condition") {
77
- return [{
78
- type: "target",
79
- position: "left"
80
- }, {
81
- type: "source",
82
- position: "right"
83
- },
84
- // true
85
- {
86
- type: "source",
87
- position: "bottom"
88
- }
89
- // false
90
- ].filter(h => h.type === type);
91
- }
92
- if (node.type === "ai-llm" || node.type === "ai-prompt" || node.type === "ai-agent" || node.type === "ai-tool" || node.type === "ai-memory") {
93
- return [{
94
- type: "target",
95
- position: "left"
96
- }, {
97
- type: "source",
98
- position: "right"
99
- }].filter(h => h.type === type);
100
- }
101
- return [{
102
- type: "target",
103
- position: "left"
104
- }, {
105
- type: "source",
106
- position: "right"
107
- }].filter(h => h.type === type);
108
- };
109
- (0, _vitest.describe)("flow/utils/node-handles", () => {
110
- (0, _vitest.describe)("Default node handles", () => {
111
- (0, _vitest.it)("should return handles for default node type", () => {
112
- const node = {
113
- id: "1",
114
- type: "default",
115
- position: {
116
- x: 0,
117
- y: 0
118
- },
119
- data: {
120
- label: "Test"
121
- }
122
- };
123
- const handles = getHandles(node, "source");
124
- (0, _vitest.expect)(handles).toBeDefined();
125
- (0, _vitest.expect)(handles.length).toBeGreaterThan(0);
126
- });
127
- (0, _vitest.it)("should return source and target handles for default node", () => {
128
- const node = {
129
- id: "1",
130
- type: "default",
131
- position: {
132
- x: 0,
133
- y: 0
134
- },
135
- data: {
136
- label: "Test"
137
- }
138
- };
139
- const sourceHandles = getHandles(node, "source");
140
- const targetHandles = getHandles(node, "target");
141
- (0, _vitest.expect)(sourceHandles.length).toBe(1);
142
- (0, _vitest.expect)(sourceHandles[0]?.position).toBe("right");
143
- (0, _vitest.expect)(targetHandles.length).toBe(1);
144
- (0, _vitest.expect)(targetHandles[0]?.position).toBe("left");
145
- });
146
- });
147
- (0, _vitest.describe)("BPMN node handles", () => {
148
- (0, _vitest.it)("should return source handle for bpmn-start", () => {
149
- const node = {
150
- id: "start1",
151
- type: "bpmn-start",
152
- position: {
153
- x: 0,
154
- y: 0
155
- },
156
- data: {
157
- label: "Start"
158
- }
159
- };
160
- const handles = getHandles(node, "source");
161
- (0, _vitest.expect)(handles.length).toBe(1);
162
- (0, _vitest.expect)(handles[0]?.position).toBe("right");
163
- });
164
- (0, _vitest.it)("should return target handle for bpmn-end", () => {
165
- const node = {
166
- id: "end1",
167
- type: "bpmn-end",
168
- position: {
169
- x: 0,
170
- y: 0
171
- },
172
- data: {
173
- label: "End"
174
- }
175
- };
176
- const handles = getHandles(node, "target");
177
- (0, _vitest.expect)(handles.length).toBe(1);
178
- (0, _vitest.expect)(handles[0]?.position).toBe("left");
179
- });
180
- (0, _vitest.it)("should return both handles for bpmn-task", () => {
181
- const node = {
182
- id: "task1",
183
- type: "bpmn-task",
184
- position: {
185
- x: 0,
186
- y: 0
187
- },
188
- data: {
189
- label: "Task"
190
- }
191
- };
192
- const sourceHandles = getHandles(node, "source");
193
- const targetHandles = getHandles(node, "target");
194
- (0, _vitest.expect)(sourceHandles.length).toBe(1);
195
- (0, _vitest.expect)(targetHandles.length).toBe(1);
196
- });
197
- (0, _vitest.it)("should return 4 handles for bpmn-exclusive-gateway", () => {
198
- const node = {
199
- id: "gw1",
200
- type: "bpmn-exclusive-gateway",
201
- position: {
202
- x: 0,
203
- y: 0
204
- },
205
- data: {
206
- label: "Gateway"
207
- }
208
- };
209
- const sourceHandles = getHandles(node, "source");
210
- const targetHandles = getHandles(node, "target");
211
- (0, _vitest.expect)(sourceHandles.length).toBe(2);
212
- (0, _vitest.expect)(targetHandles.length).toBe(2);
213
- });
214
- });
215
- (0, _vitest.describe)("AI Workflow node handles", () => {
216
- (0, _vitest.it)("should return handles for ai-llm", () => {
217
- const node = {
218
- id: "llm1",
219
- type: "ai-llm",
220
- position: {
221
- x: 0,
222
- y: 0
223
- },
224
- data: {
225
- label: "LLM",
226
- model: "gpt-4"
227
- }
228
- };
229
- const sourceHandles = getHandles(node, "source");
230
- const targetHandles = getHandles(node, "target");
231
- (0, _vitest.expect)(sourceHandles.length).toBe(1);
232
- (0, _vitest.expect)(targetHandles.length).toBe(1);
233
- });
234
- (0, _vitest.it)("should return source handle for ai-start", () => {
235
- const node = {
236
- id: "start1",
237
- type: "ai-start",
238
- position: {
239
- x: 0,
240
- y: 0
241
- },
242
- data: {
243
- label: "Start"
244
- }
245
- };
246
- const handles = getHandles(node, "source");
247
- (0, _vitest.expect)(handles.length).toBe(1);
248
- (0, _vitest.expect)(handles[0]?.position).toBe("right");
249
- });
250
- (0, _vitest.it)("should return target handle for ai-end", () => {
251
- const node = {
252
- id: "end1",
253
- type: "ai-end",
254
- position: {
255
- x: 0,
256
- y: 0
257
- },
258
- data: {
259
- label: "End"
260
- }
261
- };
262
- const handles = getHandles(node, "target");
263
- (0, _vitest.expect)(handles.length).toBe(1);
264
- (0, _vitest.expect)(handles[0]?.position).toBe("left");
265
- });
266
- (0, _vitest.it)("should return 3 handles for ai-condition (left target, right source, bottom source)", () => {
267
- const node = {
268
- id: "cond1",
269
- type: "ai-condition",
270
- position: {
271
- x: 0,
272
- y: 0
273
- },
274
- data: {
275
- label: "Condition",
276
- condition: "if"
277
- }
278
- };
279
- const sourceHandles = getHandles(node, "source");
280
- const targetHandles = getHandles(node, "target");
281
- (0, _vitest.expect)(sourceHandles.length).toBe(2);
282
- (0, _vitest.expect)(targetHandles.length).toBe(1);
283
- });
284
- });
285
- (0, _vitest.describe)("Input/Output node handles", () => {
286
- (0, _vitest.it)("should return only source handle for input node", () => {
287
- const node = {
288
- id: "input1",
289
- type: "input",
290
- position: {
291
- x: 0,
292
- y: 0
293
- },
294
- data: {
295
- label: "Input"
296
- }
297
- };
298
- const sourceHandles = getHandles(node, "source");
299
- const targetHandles = getHandles(node, "target");
300
- (0, _vitest.expect)(sourceHandles.length).toBe(1);
301
- (0, _vitest.expect)(targetHandles.length).toBe(0);
302
- });
303
- (0, _vitest.it)("should return only target handle for output node", () => {
304
- const node = {
305
- id: "output1",
306
- type: "output",
307
- position: {
308
- x: 0,
309
- y: 0
310
- },
311
- data: {
312
- label: "Output"
313
- }
314
- };
315
- const sourceHandles = getHandles(node, "source");
316
- const targetHandles = getHandles(node, "target");
317
- (0, _vitest.expect)(sourceHandles.length).toBe(0);
318
- (0, _vitest.expect)(targetHandles.length).toBe(1);
319
- });
320
- });
321
- (0, _vitest.describe)("Group node handles", () => {
322
- (0, _vitest.it)("should return empty array for group node", () => {
323
- const node = {
324
- id: "group1",
325
- type: "group",
326
- position: {
327
- x: 0,
328
- y: 0
329
- },
330
- data: {
331
- label: "Group"
332
- }
333
- };
334
- const sourceHandles = getHandles(node, "source");
335
- const targetHandles = getHandles(node, "target");
336
- (0, _vitest.expect)(sourceHandles.length).toBe(0);
337
- (0, _vitest.expect)(targetHandles.length).toBe(0);
338
- });
339
- });
340
- });
@@ -1 +0,0 @@
1
- export {};