@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.
Files changed (142) hide show
  1. package/package.json +6 -6
  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,412 +0,0 @@
1
- "use strict";
2
-
3
- var _vitest = require("vitest");
4
- var _vue = require("vue");
5
- var _controls = require("../plugins/plugins/controls.cjs");
6
- var _grid = require("../plugins/plugins/grid.cjs");
7
- var _keyboard = require("../plugins/plugins/keyboard.cjs");
8
- var _minimap = require("../plugins/plugins/minimap.cjs");
9
- var _snap = require("../plugins/plugins/snap.cjs");
10
- function createMockFlowInstance() {
11
- const nodes = (0, _vue.ref)([]);
12
- const edges = (0, _vue.ref)([]);
13
- const viewport = (0, _vue.ref)({
14
- x: 0,
15
- y: 0,
16
- zoom: 1
17
- });
18
- const draggingNodeId = (0, _vue.ref)(null);
19
- return {
20
- nodes,
21
- edges,
22
- viewport,
23
- draggingNodeId,
24
- addNode: _vitest.vi.fn(),
25
- removeNode: _vitest.vi.fn(),
26
- updateNode: _vitest.vi.fn(),
27
- getNode: _vitest.vi.fn(),
28
- addEdge: _vitest.vi.fn(),
29
- removeEdge: _vitest.vi.fn(),
30
- updateEdge: _vitest.vi.fn(),
31
- getEdge: _vitest.vi.fn(),
32
- setViewport: _vitest.vi.fn(),
33
- fitView: _vitest.vi.fn(),
34
- zoomIn: _vitest.vi.fn(),
35
- zoomOut: _vitest.vi.fn(),
36
- centerView: _vitest.vi.fn(),
37
- selectNode: _vitest.vi.fn(),
38
- selectEdge: _vitest.vi.fn(),
39
- clearSelection: _vitest.vi.fn(),
40
- getNodes: _vitest.vi.fn(() => nodes.value),
41
- getEdges: _vitest.vi.fn(() => edges.value),
42
- getViewport: _vitest.vi.fn(() => viewport.value),
43
- screenToCanvas: _vitest.vi.fn(),
44
- canvasToScreen: _vitest.vi.fn(),
45
- on: _vitest.vi.fn(),
46
- off: _vitest.vi.fn(),
47
- emit: _vitest.vi.fn(),
48
- isValidConnection: _vitest.vi.fn(() => true),
49
- $el: void 0,
50
- usePlugin: _vitest.vi.fn(),
51
- removePlugin: _vitest.vi.fn()
52
- };
53
- }
54
- (0, _vitest.describe)("flow/plugins/plugins/controls", () => {
55
- let consoleLogSpy;
56
- (0, _vitest.beforeEach)(() => {
57
- consoleLogSpy = _vitest.vi.spyOn(console, "log").mockImplementation(() => {});
58
- });
59
- (0, _vitest.afterEach)(() => {
60
- consoleLogSpy.mockRestore();
61
- });
62
- (0, _vitest.describe)("createControlsPlugin", () => {
63
- (0, _vitest.it)("should create plugin with correct id and name", () => {
64
- const plugin = (0, _controls.createControlsPlugin)();
65
- (0, _vitest.expect)(plugin.id).toBe("controls");
66
- (0, _vitest.expect)(plugin.name).toBe("Controls");
67
- (0, _vitest.expect)(plugin.version).toBe("1.0.0");
68
- (0, _vitest.expect)(plugin.description).toBe("Displays a set of controls for zooming and fitting the view");
69
- });
70
- (0, _vitest.it)("should have a component", () => {
71
- const plugin = (0, _controls.createControlsPlugin)();
72
- (0, _vitest.expect)(plugin.component).toBeDefined();
73
- });
74
- (0, _vitest.it)("should install with default options", () => {
75
- const flow = createMockFlowInstance();
76
- const plugin = (0, _controls.createControlsPlugin)();
77
- plugin.install(flow);
78
- (0, _vitest.expect)(consoleLogSpy).toHaveBeenCalledWith("[Controls Plugin] Installed");
79
- });
80
- (0, _vitest.it)("should merge custom options", () => {
81
- const plugin = (0, _controls.createControlsPlugin)({
82
- enabled: true,
83
- position: "top-right",
84
- showZoom: true,
85
- showFitView: false,
86
- showInteractive: false
87
- });
88
- (0, _vitest.expect)(plugin.componentProps).toEqual({
89
- position: "top-right",
90
- showZoom: true,
91
- showFitView: false,
92
- showInteractive: false
93
- });
94
- });
95
- (0, _vitest.it)("should use default position when not provided", () => {
96
- const plugin = (0, _controls.createControlsPlugin)();
97
- (0, _vitest.expect)(plugin.componentProps?.position).toBe("bottom-left");
98
- });
99
- (0, _vitest.it)("should use default show options", () => {
100
- const plugin = (0, _controls.createControlsPlugin)();
101
- (0, _vitest.expect)(plugin.componentProps?.showZoom).toBe(true);
102
- (0, _vitest.expect)(plugin.componentProps?.showFitView).toBe(true);
103
- (0, _vitest.expect)(plugin.componentProps?.showInteractive).toBe(true);
104
- });
105
- (0, _vitest.it)("should support all position options", () => {
106
- const positions = ["top-left", "top-right", "bottom-left", "bottom-right"];
107
- for (const pos of positions) {
108
- const plugin = (0, _controls.createControlsPlugin)({
109
- position: pos
110
- });
111
- (0, _vitest.expect)(plugin.componentProps?.position).toBe(pos);
112
- }
113
- });
114
- });
115
- });
116
- (0, _vitest.describe)("flow/plugins/plugins/grid", () => {
117
- let consoleLogSpy;
118
- (0, _vitest.beforeEach)(() => {
119
- consoleLogSpy = _vitest.vi.spyOn(console, "log").mockImplementation(() => {});
120
- });
121
- (0, _vitest.afterEach)(() => {
122
- consoleLogSpy.mockRestore();
123
- });
124
- (0, _vitest.describe)("createGridPlugin", () => {
125
- (0, _vitest.it)("should create plugin with correct id and name", () => {
126
- const plugin = (0, _grid.createGridPlugin)();
127
- (0, _vitest.expect)(plugin.id).toBe("grid");
128
- (0, _vitest.expect)(plugin.name).toBe("Grid");
129
- (0, _vitest.expect)(plugin.version).toBe("1.0.0");
130
- (0, _vitest.expect)(plugin.description).toBe("Displays a grid or dots background");
131
- });
132
- (0, _vitest.it)("should have a component", () => {
133
- const plugin = (0, _grid.createGridPlugin)();
134
- (0, _vitest.expect)(plugin.component).toBeDefined();
135
- });
136
- (0, _vitest.it)("should install with default options", () => {
137
- const flow = createMockFlowInstance();
138
- const plugin = (0, _grid.createGridPlugin)();
139
- plugin.install(flow);
140
- (0, _vitest.expect)(consoleLogSpy).toHaveBeenCalledWith("[Grid Plugin] Installed");
141
- });
142
- (0, _vitest.it)("should merge custom options", () => {
143
- const plugin = (0, _grid.createGridPlugin)({
144
- enabled: true,
145
- type: "grid",
146
- color: "#ff0000",
147
- gap: 30
148
- });
149
- (0, _vitest.expect)(plugin.componentProps).toEqual({
150
- type: "grid",
151
- color: "#ff0000",
152
- gap: 30
153
- });
154
- });
155
- (0, _vitest.it)("should use default type dots", () => {
156
- const plugin = (0, _grid.createGridPlugin)();
157
- (0, _vitest.expect)(plugin.componentProps?.type).toBe("dots");
158
- });
159
- (0, _vitest.it)("should use default gap", () => {
160
- const plugin = (0, _grid.createGridPlugin)();
161
- (0, _vitest.expect)(plugin.componentProps?.gap).toBe(20);
162
- });
163
- (0, _vitest.it)("should use default color", () => {
164
- const plugin = (0, _grid.createGridPlugin)();
165
- (0, _vitest.expect)(plugin.componentProps?.color).toBe("#e5e5e5");
166
- });
167
- (0, _vitest.it)("should support grid type", () => {
168
- const plugin = (0, _grid.createGridPlugin)({
169
- type: "grid"
170
- });
171
- (0, _vitest.expect)(plugin.componentProps?.type).toBe("grid");
172
- });
173
- });
174
- });
175
- (0, _vitest.describe)("flow/plugins/plugins/keyboard", () => {
176
- let consoleLogSpy;
177
- (0, _vitest.beforeEach)(() => {
178
- consoleLogSpy = _vitest.vi.spyOn(console, "log").mockImplementation(() => {});
179
- });
180
- (0, _vitest.afterEach)(() => {
181
- consoleLogSpy.mockRestore();
182
- });
183
- (0, _vitest.describe)("createKeyboardPlugin", () => {
184
- (0, _vitest.it)("should create plugin with correct id and name", () => {
185
- const plugin = (0, _keyboard.createKeyboardPlugin)();
186
- (0, _vitest.expect)(plugin.id).toBe("keyboard");
187
- (0, _vitest.expect)(plugin.name).toBe("Keyboard");
188
- });
189
- (0, _vitest.it)("should install with default options", () => {
190
- const flow = createMockFlowInstance();
191
- const plugin = (0, _keyboard.createKeyboardPlugin)();
192
- plugin.install(flow);
193
- (0, _vitest.expect)(consoleLogSpy).toHaveBeenCalledWith("Keyboard plugin installed", {
194
- enabled: true,
195
- delete: true,
196
- backspace: true,
197
- ctrlZ: true,
198
- ctrlY: true,
199
- escape: true
200
- });
201
- });
202
- (0, _vitest.it)("should merge custom options", () => {
203
- const plugin = (0, _keyboard.createKeyboardPlugin)({
204
- enabled: false,
205
- delete: false,
206
- backspace: false,
207
- ctrlZ: false,
208
- ctrlY: false,
209
- escape: false
210
- });
211
- plugin.install(createMockFlowInstance());
212
- (0, _vitest.expect)(consoleLogSpy).toHaveBeenCalledWith("Keyboard plugin installed", {
213
- enabled: false,
214
- delete: false,
215
- backspace: false,
216
- ctrlZ: false,
217
- ctrlY: false,
218
- escape: false
219
- });
220
- });
221
- (0, _vitest.it)("should accept partial options", () => {
222
- const plugin = (0, _keyboard.createKeyboardPlugin)({
223
- delete: false
224
- });
225
- (0, _vitest.expect)(plugin.id).toBe("keyboard");
226
- });
227
- (0, _vitest.it)("should override individual options", () => {
228
- const plugin = (0, _keyboard.createKeyboardPlugin)({
229
- ctrlZ: false,
230
- ctrlY: false
231
- });
232
- plugin.install(createMockFlowInstance());
233
- (0, _vitest.expect)(consoleLogSpy).toHaveBeenCalledWith("Keyboard plugin installed", {
234
- enabled: true,
235
- delete: true,
236
- backspace: true,
237
- ctrlZ: false,
238
- ctrlY: false,
239
- escape: true
240
- });
241
- });
242
- });
243
- });
244
- (0, _vitest.describe)("flow/plugins/plugins/minimap", () => {
245
- let consoleLogSpy;
246
- (0, _vitest.beforeEach)(() => {
247
- consoleLogSpy = _vitest.vi.spyOn(console, "log").mockImplementation(() => {});
248
- });
249
- (0, _vitest.afterEach)(() => {
250
- consoleLogSpy.mockRestore();
251
- });
252
- (0, _vitest.describe)("createMiniMapPlugin", () => {
253
- (0, _vitest.it)("should create plugin with correct id and name", () => {
254
- const plugin = (0, _minimap.createMiniMapPlugin)();
255
- (0, _vitest.expect)(plugin.id).toBe("minimap");
256
- (0, _vitest.expect)(plugin.name).toBe("Minimap");
257
- (0, _vitest.expect)(plugin.version).toBe("1.0.0");
258
- (0, _vitest.expect)(plugin.description).toBe("Displays a minimap for navigation");
259
- });
260
- (0, _vitest.it)("should have a component", () => {
261
- const plugin = (0, _minimap.createMiniMapPlugin)();
262
- (0, _vitest.expect)(plugin.component).toBeDefined();
263
- });
264
- (0, _vitest.it)("should install with default options", () => {
265
- const flow = createMockFlowInstance();
266
- const plugin = (0, _minimap.createMiniMapPlugin)();
267
- plugin.install(flow);
268
- (0, _vitest.expect)(consoleLogSpy).toHaveBeenCalled();
269
- });
270
- (0, _vitest.it)("should use default position bottom-right", () => {
271
- const plugin = (0, _minimap.createMiniMapPlugin)();
272
- (0, _vitest.expect)(plugin.componentProps?.position).toBe("bottom-right");
273
- });
274
- (0, _vitest.it)("should use default dimensions", () => {
275
- const plugin = (0, _minimap.createMiniMapPlugin)();
276
- (0, _vitest.expect)(plugin.componentProps?.width).toBe(200);
277
- (0, _vitest.expect)(plugin.componentProps?.height).toBe(150);
278
- });
279
- (0, _vitest.it)("should use default mask colors", () => {
280
- const plugin = (0, _minimap.createMiniMapPlugin)();
281
- (0, _vitest.expect)(plugin.componentProps?.maskColor).toBe("rgba(240, 240, 240, 0.6)");
282
- (0, _vitest.expect)(plugin.componentProps?.maskStrokeColor).toBe("#ddd");
283
- (0, _vitest.expect)(plugin.componentProps?.maskStrokeWidth).toBe(1);
284
- });
285
- (0, _vitest.it)("should use default pannable and zoomable", () => {
286
- const plugin = (0, _minimap.createMiniMapPlugin)();
287
- (0, _vitest.expect)(plugin.componentProps?.pannable).toBe(true);
288
- (0, _vitest.expect)(plugin.componentProps?.zoomable).toBe(true);
289
- });
290
- (0, _vitest.it)("should support custom position", () => {
291
- const positions = ["top-left", "top-right", "bottom-left", "bottom-right"];
292
- for (const pos of positions) {
293
- const plugin = (0, _minimap.createMiniMapPlugin)({
294
- position: pos
295
- });
296
- (0, _vitest.expect)(plugin.componentProps?.position).toBe(pos);
297
- }
298
- });
299
- (0, _vitest.it)("should support custom dimensions", () => {
300
- const plugin = (0, _minimap.createMiniMapPlugin)({
301
- width: 300,
302
- height: 200
303
- });
304
- (0, _vitest.expect)(plugin.componentProps?.width).toBe(300);
305
- (0, _vitest.expect)(plugin.componentProps?.height).toBe(200);
306
- });
307
- (0, _vitest.it)("should support custom node color functions", () => {
308
- const customNodeColor = node => "#ff0000";
309
- const customNodeStrokeColor = node => "#00ff00";
310
- const plugin = (0, _minimap.createMiniMapPlugin)({
311
- nodeColor: customNodeColor,
312
- nodeStrokeColor: customNodeStrokeColor
313
- });
314
- (0, _vitest.expect)(plugin.componentProps?.nodeColor).toBe(customNodeColor);
315
- (0, _vitest.expect)(plugin.componentProps?.nodeStrokeColor).toBe(customNodeStrokeColor);
316
- });
317
- (0, _vitest.it)("should support interactive option", () => {
318
- const pluginEnabled = (0, _minimap.createMiniMapPlugin)({
319
- interactive: true
320
- });
321
- const pluginDisabled = (0, _minimap.createMiniMapPlugin)({
322
- interactive: false
323
- });
324
- (0, _vitest.expect)(pluginEnabled.componentProps?.interactive).toBe(true);
325
- (0, _vitest.expect)(pluginDisabled.componentProps?.interactive).toBe(false);
326
- });
327
- (0, _vitest.it)("should support layout controls options", () => {
328
- const plugin = (0, _minimap.createMiniMapPlugin)({
329
- showLayoutControls: true,
330
- layoutType: "dagre",
331
- layoutDirection: "LR"
332
- });
333
- (0, _vitest.expect)(plugin.componentProps?.showLayoutControls).toBe(true);
334
- (0, _vitest.expect)(plugin.componentProps?.layoutType).toBe("dagre");
335
- (0, _vitest.expect)(plugin.componentProps?.layoutDirection).toBe("LR");
336
- });
337
- (0, _vitest.it)("should support all layout directions", () => {
338
- const directions = ["TB", "BT", "LR", "RL"];
339
- for (const dir of directions) {
340
- const plugin = (0, _minimap.createMiniMapPlugin)({
341
- layoutDirection: dir
342
- });
343
- (0, _vitest.expect)(plugin.componentProps?.layoutDirection).toBe(dir);
344
- }
345
- });
346
- (0, _vitest.it)("should support all layout types", () => {
347
- const types = ["dagre", "elk", "force", "grid", "none"];
348
- for (const type of types) {
349
- const plugin = (0, _minimap.createMiniMapPlugin)({
350
- layoutType: type
351
- });
352
- (0, _vitest.expect)(plugin.componentProps?.layoutType).toBe(type);
353
- }
354
- });
355
- });
356
- });
357
- (0, _vitest.describe)("flow/plugins/plugins/snap", () => {
358
- let consoleLogSpy;
359
- (0, _vitest.beforeEach)(() => {
360
- consoleLogSpy = _vitest.vi.spyOn(console, "log").mockImplementation(() => {});
361
- });
362
- (0, _vitest.afterEach)(() => {
363
- consoleLogSpy.mockRestore();
364
- });
365
- (0, _vitest.describe)("createSnapPlugin", () => {
366
- (0, _vitest.it)("should create plugin with correct id and name", () => {
367
- const plugin = (0, _snap.createSnapPlugin)();
368
- (0, _vitest.expect)(plugin.id).toBe("snap");
369
- (0, _vitest.expect)(plugin.name).toBe("Snap");
370
- (0, _vitest.expect)(plugin.version).toBe("1.0.0");
371
- (0, _vitest.expect)(plugin.description).toBe("Enables grid snapping and alignment lines");
372
- });
373
- (0, _vitest.it)("should have a component when showAlignmentLines is true", () => {
374
- const plugin = (0, _snap.createSnapPlugin)({
375
- showAlignmentLines: true
376
- });
377
- (0, _vitest.expect)(plugin.component).toBeDefined();
378
- });
379
- (0, _vitest.it)("should not have a component when showAlignmentLines is false", () => {
380
- const plugin = (0, _snap.createSnapPlugin)({
381
- showAlignmentLines: false
382
- });
383
- (0, _vitest.expect)(plugin.component).toBeUndefined();
384
- });
385
- (0, _vitest.it)("should install with default options", () => {
386
- const flow = createMockFlowInstance();
387
- const plugin = (0, _snap.createSnapPlugin)();
388
- plugin.install(flow);
389
- (0, _vitest.expect)(consoleLogSpy).toHaveBeenCalled();
390
- });
391
- (0, _vitest.it)("should not install when enabled is false", () => {
392
- const flow = createMockFlowInstance();
393
- const plugin = (0, _snap.createSnapPlugin)({
394
- enabled: false
395
- });
396
- plugin.install(flow);
397
- (0, _vitest.expect)(consoleLogSpy).not.toHaveBeenCalled();
398
- });
399
- (0, _vitest.it)("should use default snap options", () => {
400
- const plugin = (0, _snap.createSnapPlugin)();
401
- (0, _vitest.expect)(plugin.componentProps?.snapThreshold).toBe(10);
402
- });
403
- (0, _vitest.it)("should support custom snap options", () => {
404
- const plugin = (0, _snap.createSnapPlugin)({
405
- snapToGrid: true,
406
- gridSize: 20,
407
- snapThreshold: 15
408
- });
409
- (0, _vitest.expect)(plugin.componentProps?.snapThreshold).toBe(15);
410
- });
411
- });
412
- });
@@ -1 +0,0 @@
1
- export {};