@yh-ui/flow 1.0.26 → 1.0.36
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.
- package/package.json +6 -6
- package/dist/__tests__/ai-workflow.ssr.test.cjs +0 -352
- package/dist/__tests__/ai-workflow.ssr.test.d.ts +0 -1
- package/dist/__tests__/ai-workflow.ssr.test.mjs +0 -283
- package/dist/__tests__/ai-workflow.test.cjs +0 -109
- package/dist/__tests__/ai-workflow.test.d.ts +0 -1
- package/dist/__tests__/ai-workflow.test.mjs +0 -112
- package/dist/__tests__/bpmn-engine.test.cjs +0 -357
- package/dist/__tests__/bpmn-engine.test.d.ts +0 -1
- package/dist/__tests__/bpmn-engine.test.mjs +0 -406
- package/dist/__tests__/bpmn-utils.test.cjs +0 -268
- package/dist/__tests__/bpmn-utils.test.d.ts +0 -1
- package/dist/__tests__/bpmn-utils.test.mjs +0 -227
- package/dist/__tests__/bpmn-xml.test.cjs +0 -150
- package/dist/__tests__/bpmn-xml.test.d.ts +0 -1
- package/dist/__tests__/bpmn-xml.test.mjs +0 -112
- package/dist/__tests__/bpmn.ssr.test.cjs +0 -278
- package/dist/__tests__/bpmn.ssr.test.d.ts +0 -1
- package/dist/__tests__/bpmn.ssr.test.mjs +0 -237
- package/dist/__tests__/bpmn.test.cjs +0 -103
- package/dist/__tests__/bpmn.test.d.ts +0 -1
- package/dist/__tests__/bpmn.test.mjs +0 -106
- package/dist/__tests__/collaboration.test.cjs +0 -487
- package/dist/__tests__/collaboration.test.d.ts +0 -1
- package/dist/__tests__/collaboration.test.mjs +0 -424
- package/dist/__tests__/custom-types.test.cjs +0 -300
- package/dist/__tests__/custom-types.test.d.ts +0 -1
- package/dist/__tests__/custom-types.test.mjs +0 -248
- package/dist/__tests__/edge-types.test.cjs +0 -275
- package/dist/__tests__/edge-types.test.d.ts +0 -1
- package/dist/__tests__/edge-types.test.mjs +0 -234
- package/dist/__tests__/edge-utils.test.cjs +0 -375
- package/dist/__tests__/edge-utils.test.d.ts +0 -1
- package/dist/__tests__/edge-utils.test.mjs +0 -376
- package/dist/__tests__/edge.test.cjs +0 -56
- package/dist/__tests__/edge.test.d.ts +0 -1
- package/dist/__tests__/edge.test.mjs +0 -69
- package/dist/__tests__/event-bus.test.cjs +0 -80
- package/dist/__tests__/event-bus.test.d.ts +0 -1
- package/dist/__tests__/event-bus.test.mjs +0 -51
- package/dist/__tests__/events-types.test.cjs +0 -184
- package/dist/__tests__/events-types.test.d.ts +0 -1
- package/dist/__tests__/events-types.test.mjs +0 -184
- package/dist/__tests__/export-image-plugin.test.cjs +0 -142
- package/dist/__tests__/export-image-plugin.test.d.ts +0 -1
- package/dist/__tests__/export-image-plugin.test.mjs +0 -118
- package/dist/__tests__/export.test.cjs +0 -237
- package/dist/__tests__/export.test.d.ts +0 -1
- package/dist/__tests__/export.test.mjs +0 -171
- package/dist/__tests__/flow-context.test.cjs +0 -16
- package/dist/__tests__/flow-context.test.d.ts +0 -1
- package/dist/__tests__/flow-context.test.mjs +0 -16
- package/dist/__tests__/flow-props.test.cjs +0 -94
- package/dist/__tests__/flow-props.test.d.ts +0 -1
- package/dist/__tests__/flow-props.test.mjs +0 -92
- package/dist/__tests__/flow.ssr.test.cjs +0 -156
- package/dist/__tests__/flow.ssr.test.d.ts +0 -1
- package/dist/__tests__/flow.ssr.test.mjs +0 -112
- package/dist/__tests__/geometry.test.cjs +0 -191
- package/dist/__tests__/geometry.test.d.ts +0 -1
- package/dist/__tests__/geometry.test.mjs +0 -105
- package/dist/__tests__/graph.test.cjs +0 -115
- package/dist/__tests__/graph.test.d.ts +0 -1
- package/dist/__tests__/graph.test.mjs +0 -85
- package/dist/__tests__/history-plugin.test.cjs +0 -191
- package/dist/__tests__/history-plugin.test.d.ts +0 -1
- package/dist/__tests__/history-plugin.test.mjs +0 -161
- package/dist/__tests__/history.test.cjs +0 -81
- package/dist/__tests__/history.test.d.ts +0 -1
- package/dist/__tests__/history.test.mjs +0 -43
- package/dist/__tests__/layout-plugin.test.cjs +0 -233
- package/dist/__tests__/layout-plugin.test.d.ts +0 -1
- package/dist/__tests__/layout-plugin.test.mjs +0 -215
- package/dist/__tests__/layout.test.cjs +0 -213
- package/dist/__tests__/layout.test.d.ts +0 -1
- package/dist/__tests__/layout.test.mjs +0 -170
- package/dist/__tests__/node-edit-panel.ssr.test.cjs +0 -168
- package/dist/__tests__/node-edit-panel.ssr.test.d.ts +0 -1
- package/dist/__tests__/node-edit-panel.ssr.test.mjs +0 -118
- package/dist/__tests__/node-group-plugin.test.cjs +0 -235
- package/dist/__tests__/node-group-plugin.test.d.ts +0 -1
- package/dist/__tests__/node-group-plugin.test.mjs +0 -187
- package/dist/__tests__/node-handles.test.cjs +0 -340
- package/dist/__tests__/node-handles.test.d.ts +0 -1
- package/dist/__tests__/node-handles.test.mjs +0 -230
- package/dist/__tests__/node-types.test.cjs +0 -368
- package/dist/__tests__/node-types.test.d.ts +0 -1
- package/dist/__tests__/node-types.test.mjs +0 -292
- package/dist/__tests__/performance.test.cjs +0 -313
- package/dist/__tests__/performance.test.d.ts +0 -1
- package/dist/__tests__/performance.test.mjs +0 -218
- package/dist/__tests__/plugin-advanced.test.cjs +0 -301
- package/dist/__tests__/plugin-advanced.test.d.ts +0 -1
- package/dist/__tests__/plugin-advanced.test.mjs +0 -225
- package/dist/__tests__/plugin.test.cjs +0 -151
- package/dist/__tests__/plugin.test.d.ts +0 -1
- package/dist/__tests__/plugin.test.mjs +0 -116
- package/dist/__tests__/plugins.test.cjs +0 -412
- package/dist/__tests__/plugins.test.d.ts +0 -1
- package/dist/__tests__/plugins.test.mjs +0 -402
- package/dist/__tests__/screenshot-capture.test.cjs +0 -183
- package/dist/__tests__/screenshot-capture.test.d.ts +0 -1
- package/dist/__tests__/screenshot-capture.test.mjs +0 -124
- package/dist/__tests__/screenshot.test.cjs +0 -74
- package/dist/__tests__/screenshot.test.d.ts +0 -1
- package/dist/__tests__/screenshot.test.mjs +0 -69
- package/dist/__tests__/theme.test.cjs +0 -185
- package/dist/__tests__/theme.test.d.ts +0 -1
- package/dist/__tests__/theme.test.mjs +0 -191
- package/dist/__tests__/transform.test.cjs +0 -384
- package/dist/__tests__/transform.test.d.ts +0 -1
- package/dist/__tests__/transform.test.mjs +0 -239
- package/dist/__tests__/useAlignment.test.cjs +0 -128
- package/dist/__tests__/useAlignment.test.d.ts +0 -1
- package/dist/__tests__/useAlignment.test.mjs +0 -72
- package/dist/__tests__/useEdges.test.cjs +0 -117
- package/dist/__tests__/useEdges.test.d.ts +0 -1
- package/dist/__tests__/useEdges.test.mjs +0 -80
- package/dist/__tests__/useKeyboard.test.cjs +0 -88
- package/dist/__tests__/useKeyboard.test.d.ts +0 -1
- package/dist/__tests__/useKeyboard.test.mjs +0 -56
- package/dist/__tests__/useNodeDistribution.test.cjs +0 -643
- package/dist/__tests__/useNodeDistribution.test.d.ts +0 -1
- package/dist/__tests__/useNodeDistribution.test.mjs +0 -297
- package/dist/__tests__/useNodes.test.cjs +0 -150
- package/dist/__tests__/useNodes.test.d.ts +0 -1
- package/dist/__tests__/useNodes.test.mjs +0 -80
- package/dist/__tests__/useSelection.test.cjs +0 -112
- package/dist/__tests__/useSelection.test.d.ts +0 -1
- package/dist/__tests__/useSelection.test.mjs +0 -76
- package/dist/__tests__/useViewport.test.cjs +0 -171
- package/dist/__tests__/useViewport.test.d.ts +0 -1
- package/dist/__tests__/useViewport.test.mjs +0 -82
- package/dist/__tests__/utils/ssr.cjs +0 -124
- package/dist/__tests__/utils/ssr.d.ts +0 -33
- package/dist/__tests__/utils/ssr.mjs +0 -129
- package/dist/__tests__/validation.test.cjs +0 -95
- package/dist/__tests__/validation.test.d.ts +0 -1
- package/dist/__tests__/validation.test.mjs +0 -36
- package/dist/__tests__/viewport-types.test.cjs +0 -324
- package/dist/__tests__/viewport-types.test.d.ts +0 -1
- package/dist/__tests__/viewport-types.test.mjs +0 -207
|
@@ -1,375 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _vitest = require("vitest");
|
|
4
|
-
var _edge = require("../utils/edge.cjs");
|
|
5
|
-
function createMockNode(x, y, width = 150, height = 80, style) {
|
|
6
|
-
return {
|
|
7
|
-
id: "test",
|
|
8
|
-
type: "default",
|
|
9
|
-
position: {
|
|
10
|
-
x,
|
|
11
|
-
y
|
|
12
|
-
},
|
|
13
|
-
width,
|
|
14
|
-
height,
|
|
15
|
-
style,
|
|
16
|
-
data: {},
|
|
17
|
-
selected: false,
|
|
18
|
-
dragging: false
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
(0, _vitest.describe)("flow/utils/edge", () => {
|
|
22
|
-
(0, _vitest.describe)("getHandlePosition", () => {
|
|
23
|
-
(0, _vitest.it)("should return center for unknown position", () => {
|
|
24
|
-
const node = createMockNode(0, 0, 100, 50);
|
|
25
|
-
const result = (0, _edge.getHandlePosition)(node, "unknown");
|
|
26
|
-
(0, _vitest.expect)(result.x).toBe(50);
|
|
27
|
-
(0, _vitest.expect)(result.y).toBe(25);
|
|
28
|
-
});
|
|
29
|
-
(0, _vitest.it)("should return top handle position", () => {
|
|
30
|
-
const node = createMockNode(10, 20, 100, 50);
|
|
31
|
-
const result = (0, _edge.getHandlePosition)(node, "top");
|
|
32
|
-
(0, _vitest.expect)(result.x).toBe(60);
|
|
33
|
-
(0, _vitest.expect)(result.y).toBe(20);
|
|
34
|
-
});
|
|
35
|
-
(0, _vitest.it)("should return bottom handle position", () => {
|
|
36
|
-
const node = createMockNode(10, 20, 100, 50);
|
|
37
|
-
const result = (0, _edge.getHandlePosition)(node, "bottom");
|
|
38
|
-
(0, _vitest.expect)(result.x).toBe(60);
|
|
39
|
-
(0, _vitest.expect)(result.y).toBe(70);
|
|
40
|
-
});
|
|
41
|
-
(0, _vitest.it)("should return left handle position", () => {
|
|
42
|
-
const node = createMockNode(10, 20, 100, 50);
|
|
43
|
-
const result = (0, _edge.getHandlePosition)(node, "left");
|
|
44
|
-
(0, _vitest.expect)(result.x).toBe(10);
|
|
45
|
-
(0, _vitest.expect)(result.y).toBe(45);
|
|
46
|
-
});
|
|
47
|
-
(0, _vitest.it)("should return right handle position", () => {
|
|
48
|
-
const node = createMockNode(10, 20, 100, 50);
|
|
49
|
-
const result = (0, _edge.getHandlePosition)(node, "right");
|
|
50
|
-
(0, _vitest.expect)(result.x).toBe(110);
|
|
51
|
-
(0, _vitest.expect)(result.y).toBe(45);
|
|
52
|
-
});
|
|
53
|
-
(0, _vitest.it)("should fallback to default dimensions when width/height are undefined", () => {
|
|
54
|
-
const node = {
|
|
55
|
-
position: {
|
|
56
|
-
x: 0,
|
|
57
|
-
y: 0
|
|
58
|
-
},
|
|
59
|
-
data: {},
|
|
60
|
-
selected: false,
|
|
61
|
-
dragging: false
|
|
62
|
-
};
|
|
63
|
-
const result = (0, _edge.getHandlePosition)(node, "right");
|
|
64
|
-
(0, _vitest.expect)(result.x).toBe(150);
|
|
65
|
-
(0, _vitest.expect)(result.y).toBe(20);
|
|
66
|
-
});
|
|
67
|
-
(0, _vitest.it)("should use right as default position", () => {
|
|
68
|
-
const node = createMockNode(0, 0, 100, 50);
|
|
69
|
-
const result = (0, _edge.getHandlePosition)(node);
|
|
70
|
-
(0, _vitest.expect)(result.x).toBe(100);
|
|
71
|
-
(0, _vitest.expect)(result.y).toBe(25);
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
(0, _vitest.describe)("getBezierPath", () => {
|
|
75
|
-
(0, _vitest.it)("should generate bezier path", () => {
|
|
76
|
-
const result = (0, _edge.getBezierPath)({
|
|
77
|
-
sourceX: 0,
|
|
78
|
-
sourceY: 0,
|
|
79
|
-
targetX: 100,
|
|
80
|
-
targetY: 50,
|
|
81
|
-
sourcePosition: "right",
|
|
82
|
-
targetPosition: "left"
|
|
83
|
-
});
|
|
84
|
-
(0, _vitest.expect)(result).toContain("M0,0");
|
|
85
|
-
(0, _vitest.expect)(result).toContain("100,50");
|
|
86
|
-
(0, _vitest.expect)(result).toContain("C");
|
|
87
|
-
});
|
|
88
|
-
(0, _vitest.it)("should use custom curvature", () => {
|
|
89
|
-
const result = (0, _edge.getBezierPath)({
|
|
90
|
-
sourceX: 0,
|
|
91
|
-
sourceY: 0,
|
|
92
|
-
targetX: 100,
|
|
93
|
-
targetY: 50,
|
|
94
|
-
sourcePosition: "right",
|
|
95
|
-
targetPosition: "left",
|
|
96
|
-
curvature: 0.5
|
|
97
|
-
});
|
|
98
|
-
(0, _vitest.expect)(result).toContain("M0,0");
|
|
99
|
-
(0, _vitest.expect)(result).toContain("100,50");
|
|
100
|
-
});
|
|
101
|
-
(0, _vitest.it)("should handle vertical movement", () => {
|
|
102
|
-
const result = (0, _edge.getBezierPath)({
|
|
103
|
-
sourceX: 50,
|
|
104
|
-
sourceY: 0,
|
|
105
|
-
targetX: 50,
|
|
106
|
-
targetY: 100,
|
|
107
|
-
sourcePosition: "bottom",
|
|
108
|
-
targetPosition: "top"
|
|
109
|
-
});
|
|
110
|
-
(0, _vitest.expect)(result).toContain("M50,0");
|
|
111
|
-
(0, _vitest.expect)(result).toContain("50,100");
|
|
112
|
-
});
|
|
113
|
-
(0, _vitest.it)("should handle top to bottom direction", () => {
|
|
114
|
-
const result = (0, _edge.getBezierPath)({
|
|
115
|
-
sourceX: 50,
|
|
116
|
-
sourceY: 0,
|
|
117
|
-
targetX: 50,
|
|
118
|
-
targetY: 100,
|
|
119
|
-
sourcePosition: "top",
|
|
120
|
-
targetPosition: "bottom"
|
|
121
|
-
});
|
|
122
|
-
(0, _vitest.expect)(result).toContain("M50,0");
|
|
123
|
-
});
|
|
124
|
-
});
|
|
125
|
-
(0, _vitest.describe)("getStraightPath", () => {
|
|
126
|
-
(0, _vitest.it)("should generate straight line path", () => {
|
|
127
|
-
const result = (0, _edge.getStraightPath)({
|
|
128
|
-
sourceX: 0,
|
|
129
|
-
sourceY: 0,
|
|
130
|
-
targetX: 100,
|
|
131
|
-
targetY: 50,
|
|
132
|
-
sourcePosition: "right",
|
|
133
|
-
targetPosition: "left"
|
|
134
|
-
});
|
|
135
|
-
(0, _vitest.expect)(result).toBe("M0,0 L100,50");
|
|
136
|
-
});
|
|
137
|
-
(0, _vitest.it)("should handle diagonal line", () => {
|
|
138
|
-
const result = (0, _edge.getStraightPath)({
|
|
139
|
-
sourceX: 10,
|
|
140
|
-
sourceY: 20,
|
|
141
|
-
targetX: 300,
|
|
142
|
-
targetY: 400,
|
|
143
|
-
sourcePosition: "right",
|
|
144
|
-
targetPosition: "left"
|
|
145
|
-
});
|
|
146
|
-
(0, _vitest.expect)(result).toBe("M10,20 L300,400");
|
|
147
|
-
});
|
|
148
|
-
});
|
|
149
|
-
(0, _vitest.describe)("getStepPath", () => {
|
|
150
|
-
(0, _vitest.it)("should generate step path when source is horizontal and target is vertical", () => {
|
|
151
|
-
const result = (0, _edge.getStepPath)({
|
|
152
|
-
sourceX: 0,
|
|
153
|
-
sourceY: 0,
|
|
154
|
-
targetX: 100,
|
|
155
|
-
targetY: 50,
|
|
156
|
-
sourcePosition: "right",
|
|
157
|
-
targetPosition: "top"
|
|
158
|
-
});
|
|
159
|
-
(0, _vitest.expect)(result).toContain("M0,0");
|
|
160
|
-
(0, _vitest.expect)(result).toContain("L");
|
|
161
|
-
(0, _vitest.expect)(result).toContain("100,50");
|
|
162
|
-
});
|
|
163
|
-
(0, _vitest.it)("should generate step path when source is vertical and target is horizontal", () => {
|
|
164
|
-
const result = (0, _edge.getStepPath)({
|
|
165
|
-
sourceX: 0,
|
|
166
|
-
sourceY: 0,
|
|
167
|
-
targetX: 100,
|
|
168
|
-
targetY: 50,
|
|
169
|
-
sourcePosition: "top",
|
|
170
|
-
targetPosition: "right"
|
|
171
|
-
});
|
|
172
|
-
(0, _vitest.expect)(result).toContain("M0,0");
|
|
173
|
-
(0, _vitest.expect)(result).toContain("L");
|
|
174
|
-
});
|
|
175
|
-
(0, _vitest.it)("should handle both horizontal", () => {
|
|
176
|
-
const result = (0, _edge.getStepPath)({
|
|
177
|
-
sourceX: 0,
|
|
178
|
-
sourceY: 50,
|
|
179
|
-
targetX: 100,
|
|
180
|
-
targetY: 50,
|
|
181
|
-
sourcePosition: "right",
|
|
182
|
-
targetPosition: "left"
|
|
183
|
-
});
|
|
184
|
-
(0, _vitest.expect)(result).toContain("M0,50");
|
|
185
|
-
(0, _vitest.expect)(result).toContain("L");
|
|
186
|
-
});
|
|
187
|
-
(0, _vitest.it)("should handle both vertical", () => {
|
|
188
|
-
const result = (0, _edge.getStepPath)({
|
|
189
|
-
sourceX: 50,
|
|
190
|
-
sourceY: 0,
|
|
191
|
-
targetX: 50,
|
|
192
|
-
targetY: 100,
|
|
193
|
-
sourcePosition: "bottom",
|
|
194
|
-
targetPosition: "top"
|
|
195
|
-
});
|
|
196
|
-
(0, _vitest.expect)(result).toContain("M50,0");
|
|
197
|
-
(0, _vitest.expect)(result).toContain("L");
|
|
198
|
-
});
|
|
199
|
-
});
|
|
200
|
-
(0, _vitest.describe)("getSmoothStepPath", () => {
|
|
201
|
-
(0, _vitest.it)("should generate smooth step path for horizontal source", () => {
|
|
202
|
-
const result = (0, _edge.getSmoothStepPath)({
|
|
203
|
-
sourceX: 0,
|
|
204
|
-
sourceY: 0,
|
|
205
|
-
targetX: 100,
|
|
206
|
-
targetY: 50,
|
|
207
|
-
sourcePosition: "right",
|
|
208
|
-
targetPosition: "top"
|
|
209
|
-
});
|
|
210
|
-
(0, _vitest.expect)(result).toContain("M0,0");
|
|
211
|
-
(0, _vitest.expect)(result).toContain("Q");
|
|
212
|
-
(0, _vitest.expect)(result).toContain("100,50");
|
|
213
|
-
});
|
|
214
|
-
(0, _vitest.it)("should generate smooth step path for vertical source", () => {
|
|
215
|
-
const result = (0, _edge.getSmoothStepPath)({
|
|
216
|
-
sourceX: 0,
|
|
217
|
-
sourceY: 0,
|
|
218
|
-
targetX: 100,
|
|
219
|
-
targetY: 50,
|
|
220
|
-
sourcePosition: "bottom",
|
|
221
|
-
targetPosition: "right"
|
|
222
|
-
});
|
|
223
|
-
(0, _vitest.expect)(result).toContain("M0,0");
|
|
224
|
-
(0, _vitest.expect)(result).toContain("Q");
|
|
225
|
-
});
|
|
226
|
-
});
|
|
227
|
-
(0, _vitest.describe)("getEdgePath", () => {
|
|
228
|
-
(0, _vitest.it)("should return bezier path for bezier type", () => {
|
|
229
|
-
const result = (0, _edge.getEdgePath)("bezier", {
|
|
230
|
-
sourceX: 0,
|
|
231
|
-
sourceY: 0,
|
|
232
|
-
targetX: 100,
|
|
233
|
-
targetY: 50,
|
|
234
|
-
sourcePosition: "right",
|
|
235
|
-
targetPosition: "left"
|
|
236
|
-
});
|
|
237
|
-
(0, _vitest.expect)(result).toContain("C");
|
|
238
|
-
});
|
|
239
|
-
(0, _vitest.it)("should return straight path for straight type", () => {
|
|
240
|
-
const result = (0, _edge.getEdgePath)("straight", {
|
|
241
|
-
sourceX: 0,
|
|
242
|
-
sourceY: 0,
|
|
243
|
-
targetX: 100,
|
|
244
|
-
targetY: 50,
|
|
245
|
-
sourcePosition: "right",
|
|
246
|
-
targetPosition: "left"
|
|
247
|
-
});
|
|
248
|
-
(0, _vitest.expect)(result).toBe("M0,0 L100,50");
|
|
249
|
-
});
|
|
250
|
-
(0, _vitest.it)("should return step path for step type", () => {
|
|
251
|
-
const result = (0, _edge.getEdgePath)("step", {
|
|
252
|
-
sourceX: 0,
|
|
253
|
-
sourceY: 0,
|
|
254
|
-
targetX: 100,
|
|
255
|
-
targetY: 50,
|
|
256
|
-
sourcePosition: "right",
|
|
257
|
-
targetPosition: "top"
|
|
258
|
-
});
|
|
259
|
-
(0, _vitest.expect)(result).toContain("L");
|
|
260
|
-
});
|
|
261
|
-
(0, _vitest.it)("should return smooth step path for smoothstep type", () => {
|
|
262
|
-
const result = (0, _edge.getEdgePath)("smoothstep", {
|
|
263
|
-
sourceX: 0,
|
|
264
|
-
sourceY: 0,
|
|
265
|
-
targetX: 100,
|
|
266
|
-
targetY: 50,
|
|
267
|
-
sourcePosition: "right",
|
|
268
|
-
targetPosition: "top"
|
|
269
|
-
});
|
|
270
|
-
(0, _vitest.expect)(result).toContain("Q");
|
|
271
|
-
});
|
|
272
|
-
(0, _vitest.it)("should default to bezier for unknown type", () => {
|
|
273
|
-
const result = (0, _edge.getEdgePath)("unknown", {
|
|
274
|
-
sourceX: 0,
|
|
275
|
-
sourceY: 0,
|
|
276
|
-
targetX: 100,
|
|
277
|
-
targetY: 50,
|
|
278
|
-
sourcePosition: "right",
|
|
279
|
-
targetPosition: "left"
|
|
280
|
-
});
|
|
281
|
-
(0, _vitest.expect)(result).toContain("C");
|
|
282
|
-
});
|
|
283
|
-
(0, _vitest.it)("should default to bezier for default type", () => {
|
|
284
|
-
const result = (0, _edge.getEdgePath)("default", {
|
|
285
|
-
sourceX: 0,
|
|
286
|
-
sourceY: 0,
|
|
287
|
-
targetX: 100,
|
|
288
|
-
targetY: 50,
|
|
289
|
-
sourcePosition: "right",
|
|
290
|
-
targetPosition: "left"
|
|
291
|
-
});
|
|
292
|
-
(0, _vitest.expect)(result).toContain("C");
|
|
293
|
-
});
|
|
294
|
-
});
|
|
295
|
-
(0, _vitest.describe)("getEdgeCenter", () => {
|
|
296
|
-
(0, _vitest.it)("should return center for bezier type", () => {
|
|
297
|
-
const result = (0, _edge.getEdgeCenter)({
|
|
298
|
-
sourceX: 0,
|
|
299
|
-
sourceY: 0,
|
|
300
|
-
targetX: 100,
|
|
301
|
-
targetY: 50,
|
|
302
|
-
sourcePosition: "right",
|
|
303
|
-
targetPosition: "left",
|
|
304
|
-
type: "bezier"
|
|
305
|
-
});
|
|
306
|
-
(0, _vitest.expect)(result).toHaveProperty("x");
|
|
307
|
-
(0, _vitest.expect)(result).toHaveProperty("y");
|
|
308
|
-
(0, _vitest.expect)(result).toHaveProperty("ox");
|
|
309
|
-
(0, _vitest.expect)(result).toHaveProperty("oy");
|
|
310
|
-
});
|
|
311
|
-
(0, _vitest.it)("should return center for straight type", () => {
|
|
312
|
-
const result = (0, _edge.getEdgeCenter)({
|
|
313
|
-
sourceX: 0,
|
|
314
|
-
sourceY: 0,
|
|
315
|
-
targetX: 100,
|
|
316
|
-
targetY: 50,
|
|
317
|
-
sourcePosition: "right",
|
|
318
|
-
targetPosition: "left",
|
|
319
|
-
type: "straight"
|
|
320
|
-
});
|
|
321
|
-
(0, _vitest.expect)(result.x).toBe(50);
|
|
322
|
-
(0, _vitest.expect)(result.y).toBe(25);
|
|
323
|
-
});
|
|
324
|
-
(0, _vitest.it)("should return center for step type", () => {
|
|
325
|
-
const result = (0, _edge.getEdgeCenter)({
|
|
326
|
-
sourceX: 0,
|
|
327
|
-
sourceY: 0,
|
|
328
|
-
targetX: 100,
|
|
329
|
-
targetY: 50,
|
|
330
|
-
sourcePosition: "right",
|
|
331
|
-
targetPosition: "left",
|
|
332
|
-
type: "step"
|
|
333
|
-
});
|
|
334
|
-
(0, _vitest.expect)(result.x).toBe(50);
|
|
335
|
-
(0, _vitest.expect)(result.y).toBe(25);
|
|
336
|
-
});
|
|
337
|
-
(0, _vitest.it)("should default to bezier when type is undefined", () => {
|
|
338
|
-
const result = (0, _edge.getEdgeCenter)({
|
|
339
|
-
sourceX: 0,
|
|
340
|
-
sourceY: 0,
|
|
341
|
-
targetX: 100,
|
|
342
|
-
targetY: 50,
|
|
343
|
-
sourcePosition: "right",
|
|
344
|
-
targetPosition: "left"
|
|
345
|
-
});
|
|
346
|
-
(0, _vitest.expect)(result).toHaveProperty("x");
|
|
347
|
-
});
|
|
348
|
-
});
|
|
349
|
-
(0, _vitest.describe)("shortenEndpoint", () => {
|
|
350
|
-
(0, _vitest.it)("should shorten endpoint in the direction of source", () => {
|
|
351
|
-
const result = (0, _edge.shortenEndpoint)(100, 50, 0, 0, 10);
|
|
352
|
-
(0, _vitest.expect)(result.x).toBeLessThan(100);
|
|
353
|
-
(0, _vitest.expect)(result.y).toBeLessThan(50);
|
|
354
|
-
});
|
|
355
|
-
(0, _vitest.it)("should not shorten when distance is too small", () => {
|
|
356
|
-
const result = (0, _edge.shortenEndpoint)(5, 5, 0, 0, 10);
|
|
357
|
-
(0, _vitest.expect)(result.x).toBe(5);
|
|
358
|
-
(0, _vitest.expect)(result.y).toBe(5);
|
|
359
|
-
});
|
|
360
|
-
(0, _vitest.it)("should shorten towards source", () => {
|
|
361
|
-
const result = (0, _edge.shortenEndpoint)(200, 100, 100, 50, 10);
|
|
362
|
-
const dx = 200 - 100;
|
|
363
|
-
const dy = 100 - 50;
|
|
364
|
-
const dist = Math.sqrt(dx * dx + dy * dy);
|
|
365
|
-
const factor = 10 / dist;
|
|
366
|
-
(0, _vitest.expect)(result.x).toBeCloseTo(200 - dx * factor, 5);
|
|
367
|
-
(0, _vitest.expect)(result.y).toBeCloseTo(100 - dy * factor, 5);
|
|
368
|
-
});
|
|
369
|
-
(0, _vitest.it)("should handle vertical movement", () => {
|
|
370
|
-
const result = (0, _edge.shortenEndpoint)(50, 100, 50, 0, 10);
|
|
371
|
-
(0, _vitest.expect)(result.x).toBe(50);
|
|
372
|
-
(0, _vitest.expect)(result.y).toBeCloseTo(90, 0);
|
|
373
|
-
});
|
|
374
|
-
});
|
|
375
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|