@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,170 +0,0 @@
1
- import { describe, it, expect, vi } from "vitest";
2
- import { ref } from "vue";
3
- import { createLayoutPlugin } from "../plugins/plugins/layout.mjs";
4
- function createMockFlowInstance() {
5
- const nodes = ref([]);
6
- const edges = ref([]);
7
- const viewport = ref({ x: 0, y: 0, zoom: 1 });
8
- const draggingNodeId = ref(null);
9
- return {
10
- nodes,
11
- edges,
12
- viewport,
13
- draggingNodeId,
14
- addNode: vi.fn(),
15
- removeNode: vi.fn(),
16
- updateNode: vi.fn((id, data) => {
17
- const node = nodes.value.find((n) => n.id === id);
18
- if (node) Object.assign(node, data);
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(),
24
- getEdge: vi.fn(),
25
- setViewport: vi.fn(),
26
- fitView: vi.fn(),
27
- zoomIn: vi.fn(),
28
- zoomOut: vi.fn(),
29
- centerView: vi.fn(),
30
- selectNode: vi.fn(),
31
- selectEdge: vi.fn(),
32
- clearSelection: vi.fn(),
33
- getNodes: vi.fn(() => nodes.value),
34
- getEdges: vi.fn(() => edges.value),
35
- getViewport: vi.fn(() => viewport.value),
36
- screenToCanvas: vi.fn((x, y) => ({ x, y })),
37
- canvasToScreen: vi.fn((x, y) => ({ x, y })),
38
- on: vi.fn(),
39
- off: vi.fn(),
40
- emit: vi.fn(),
41
- isValidConnection: vi.fn(() => true),
42
- $el: void 0,
43
- usePlugin: vi.fn(),
44
- removePlugin: vi.fn()
45
- };
46
- }
47
- describe("flow/plugins/plugins/layout", () => {
48
- describe("LayoutOptions", () => {
49
- it("should have correct default options", () => {
50
- const plugin = createLayoutPlugin();
51
- const flow = createMockFlowInstance();
52
- plugin.install(flow);
53
- expect(flow.applyLayout).toBeDefined();
54
- });
55
- it("should support dagre layout type", () => {
56
- const plugin = createLayoutPlugin({ type: "dagre" });
57
- expect(plugin.id).toBe("layout");
58
- expect(plugin.name).toBe("Layout");
59
- });
60
- it("should support elk layout type", () => {
61
- const plugin = createLayoutPlugin({ type: "elk" });
62
- expect(plugin.id).toBe("layout");
63
- expect(plugin.name).toBe("Layout");
64
- });
65
- it("should support force layout type", () => {
66
- const plugin = createLayoutPlugin({ type: "force" });
67
- expect(plugin.id).toBe("layout");
68
- expect(plugin.name).toBe("Layout");
69
- });
70
- it("should support grid layout type", () => {
71
- const plugin = createLayoutPlugin({ type: "grid" });
72
- expect(plugin.id).toBe("layout");
73
- expect(plugin.name).toBe("Layout");
74
- });
75
- it("should accept direction option TB", () => {
76
- const plugin = createLayoutPlugin({ direction: "TB" });
77
- expect(plugin.id).toBe("layout");
78
- });
79
- it("should accept direction option LR", () => {
80
- const plugin = createLayoutPlugin({ direction: "LR" });
81
- expect(plugin.id).toBe("layout");
82
- });
83
- it("should accept node spacing option", () => {
84
- const plugin = createLayoutPlugin({ nodeSpacing: 100 });
85
- expect(plugin.id).toBe("layout");
86
- });
87
- it("should accept rank spacing option", () => {
88
- const plugin = createLayoutPlugin({ rankSpacing: 150 });
89
- expect(plugin.id).toBe("layout");
90
- });
91
- it("should accept elk options", () => {
92
- const plugin = createLayoutPlugin({
93
- type: "elk",
94
- elkOptions: {
95
- algorithm: "layered",
96
- direction: "DOWN",
97
- spacing: 50,
98
- edgeRouting: "POLYLINE"
99
- }
100
- });
101
- expect(plugin.id).toBe("layout");
102
- });
103
- it("should accept force options", () => {
104
- const plugin = createLayoutPlugin({
105
- type: "force",
106
- forceOptions: {
107
- strength: -500,
108
- distance: 200,
109
- iterations: 500
110
- }
111
- });
112
- expect(plugin.id).toBe("layout");
113
- });
114
- it("should accept grid options", () => {
115
- const plugin = createLayoutPlugin({
116
- type: "grid",
117
- gridOptions: {
118
- columns: 3,
119
- startX: 100,
120
- startY: 100
121
- }
122
- });
123
- expect(plugin.id).toBe("layout");
124
- });
125
- });
126
- describe("Layout execution", () => {
127
- it("should add applyLayout method to flow instance", () => {
128
- const plugin = createLayoutPlugin();
129
- const flow = createMockFlowInstance();
130
- plugin.install(flow);
131
- expect(typeof flow.applyLayout).toBe("function");
132
- });
133
- it("should return function when calling applyLayout", async () => {
134
- const plugin = createLayoutPlugin({ type: "dagre" });
135
- const flow = createMockFlowInstance();
136
- flow.nodes.value = [
137
- {
138
- id: "1",
139
- type: "default",
140
- position: { x: 0, y: 0 },
141
- data: { label: "Node 1" },
142
- width: 150,
143
- height: 50
144
- }
145
- ];
146
- flow.edges.value = [];
147
- plugin.install(flow);
148
- const result = flow.applyLayout({ type: "dagre" });
149
- expect(result === void 0 || result instanceof Promise).toBe(true);
150
- });
151
- });
152
- describe("LayoutOptions interface", () => {
153
- it("should validate LayoutOptions type field accepts dagre", () => {
154
- const options = { type: "dagre" };
155
- expect(options.type).toBe("dagre");
156
- });
157
- it("should validate LayoutOptions type field accepts elk", () => {
158
- const options = { type: "elk" };
159
- expect(options.type).toBe("elk");
160
- });
161
- it("should validate LayoutOptions type field accepts force", () => {
162
- const options = { type: "force" };
163
- expect(options.type).toBe("force");
164
- });
165
- it("should validate LayoutOptions type field accepts grid", () => {
166
- const options = { type: "grid" };
167
- expect(options.type).toBe("grid");
168
- });
169
- });
170
- });
@@ -1,168 +0,0 @@
1
- "use strict";
2
-
3
- var _vitest = require("vitest");
4
- var _NodeEditPanel = _interopRequireDefault(require("../components/NodeEditPanel.vue"));
5
- var _ssr = require("./utils/ssr.cjs");
6
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
7
- (0, _vitest.describe)("NodeEditPanel SSR", () => {
8
- (0, _vitest.it)("should render NodeEditPanel in SSR", async () => {
9
- const html = await (0, _ssr.renderSSR)(_NodeEditPanel.default, {
10
- visible: true,
11
- node: {
12
- id: "node-1",
13
- type: "default",
14
- position: {
15
- x: 0,
16
- y: 0
17
- },
18
- data: {
19
- label: "Test Node"
20
- }
21
- }
22
- });
23
- (0, _vitest.expect)(html).toBeDefined();
24
- });
25
- (0, _vitest.it)("should render with label field in SSR", async () => {
26
- const html = await (0, _ssr.renderSSR)(_NodeEditPanel.default, {
27
- visible: true,
28
- node: {
29
- id: "node-1",
30
- type: "default",
31
- position: {
32
- x: 0,
33
- y: 0
34
- },
35
- data: {
36
- label: "My Node"
37
- }
38
- }
39
- });
40
- (0, _vitest.expect)(html).toBeDefined();
41
- });
42
- (0, _vitest.it)("should render with style fields in SSR", async () => {
43
- const html = await (0, _ssr.renderSSR)(_NodeEditPanel.default, {
44
- visible: true,
45
- node: {
46
- id: "node-1",
47
- type: "default",
48
- position: {
49
- x: 0,
50
- y: 0
51
- },
52
- data: {
53
- label: "Style Node"
54
- },
55
- style: {
56
- backgroundColor: "#ff0000"
57
- }
58
- }
59
- });
60
- (0, _vitest.expect)(html).toBeDefined();
61
- });
62
- (0, _vitest.it)("should render with selected class when selected in SSR", async () => {
63
- const html = await (0, _ssr.renderSSR)(_NodeEditPanel.default, {
64
- visible: true,
65
- node: {
66
- id: "node-1",
67
- type: "default",
68
- position: {
69
- x: 0,
70
- y: 0
71
- },
72
- data: {
73
- label: "Selected Node"
74
- },
75
- selected: true
76
- }
77
- });
78
- (0, _vitest.expect)(html).toBeDefined();
79
- });
80
- (0, _vitest.it)("should not render when visible is false in SSR", async () => {
81
- const html = await (0, _ssr.renderSSR)(_NodeEditPanel.default, {
82
- visible: false,
83
- node: {
84
- id: "node-1",
85
- type: "default",
86
- position: {
87
- x: 0,
88
- y: 0
89
- },
90
- data: {
91
- label: "Hidden Node"
92
- }
93
- }
94
- });
95
- (0, _vitest.expect)(html).toBeDefined();
96
- });
97
- (0, _vitest.it)("should render close button in SSR", async () => {
98
- const html = await (0, _ssr.renderSSR)(_NodeEditPanel.default, {
99
- visible: true,
100
- node: {
101
- id: "node-1",
102
- type: "default",
103
- position: {
104
- x: 0,
105
- y: 0
106
- },
107
- data: {
108
- label: "Test"
109
- }
110
- }
111
- });
112
- (0, _vitest.expect)(html).toBeDefined();
113
- });
114
- (0, _vitest.it)("should render with width and height fields in SSR", async () => {
115
- const html = await (0, _ssr.renderSSR)(_NodeEditPanel.default, {
116
- visible: true,
117
- node: {
118
- id: "node-1",
119
- type: "default",
120
- position: {
121
- x: 0,
122
- y: 0
123
- },
124
- data: {
125
- label: "Sized Node"
126
- },
127
- width: 200,
128
- height: 100
129
- }
130
- });
131
- (0, _vitest.expect)(html).toBeDefined();
132
- });
133
- (0, _vitest.it)("should render with node ID field in SSR", async () => {
134
- const html = await (0, _ssr.renderSSR)(_NodeEditPanel.default, {
135
- visible: true,
136
- node: {
137
- id: "custom-node-id",
138
- type: "default",
139
- position: {
140
- x: 0,
141
- y: 0
142
- },
143
- data: {
144
- label: "ID Node"
145
- }
146
- }
147
- });
148
- (0, _vitest.expect)(html).toBeDefined();
149
- });
150
- (0, _vitest.it)("should hydrate without mismatch", async () => {
151
- const result = await (0, _ssr.testHydration)(_NodeEditPanel.default, {
152
- visible: true,
153
- node: {
154
- id: "node-1",
155
- type: "default",
156
- position: {
157
- x: 0,
158
- y: 0
159
- },
160
- data: {
161
- label: "Hydrate Test"
162
- }
163
- }
164
- });
165
- (0, _vitest.expect)(result.ssrHtml).toBeDefined();
166
- (0, _vitest.expect)(result.csrHtml).toBeDefined();
167
- });
168
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,118 +0,0 @@
1
- import { describe, it, expect } from "vitest";
2
- import NodeEditPanel from "../components/NodeEditPanel.vue";
3
- import { renderSSR, testHydration } from "./utils/ssr.mjs";
4
- describe("NodeEditPanel SSR", () => {
5
- it("should render NodeEditPanel in SSR", async () => {
6
- const html = await renderSSR(NodeEditPanel, {
7
- visible: true,
8
- node: {
9
- id: "node-1",
10
- type: "default",
11
- position: { x: 0, y: 0 },
12
- data: { label: "Test Node" }
13
- }
14
- });
15
- expect(html).toBeDefined();
16
- });
17
- it("should render with label field in SSR", async () => {
18
- const html = await renderSSR(NodeEditPanel, {
19
- visible: true,
20
- node: {
21
- id: "node-1",
22
- type: "default",
23
- position: { x: 0, y: 0 },
24
- data: { label: "My Node" }
25
- }
26
- });
27
- expect(html).toBeDefined();
28
- });
29
- it("should render with style fields in SSR", async () => {
30
- const html = await renderSSR(NodeEditPanel, {
31
- visible: true,
32
- node: {
33
- id: "node-1",
34
- type: "default",
35
- position: { x: 0, y: 0 },
36
- data: { label: "Style Node" },
37
- style: { backgroundColor: "#ff0000" }
38
- }
39
- });
40
- expect(html).toBeDefined();
41
- });
42
- it("should render with selected class when selected in SSR", async () => {
43
- const html = await renderSSR(NodeEditPanel, {
44
- visible: true,
45
- node: {
46
- id: "node-1",
47
- type: "default",
48
- position: { x: 0, y: 0 },
49
- data: { label: "Selected Node" },
50
- selected: true
51
- }
52
- });
53
- expect(html).toBeDefined();
54
- });
55
- it("should not render when visible is false in SSR", async () => {
56
- const html = await renderSSR(NodeEditPanel, {
57
- visible: false,
58
- node: {
59
- id: "node-1",
60
- type: "default",
61
- position: { x: 0, y: 0 },
62
- data: { label: "Hidden Node" }
63
- }
64
- });
65
- expect(html).toBeDefined();
66
- });
67
- it("should render close button in SSR", async () => {
68
- const html = await renderSSR(NodeEditPanel, {
69
- visible: true,
70
- node: {
71
- id: "node-1",
72
- type: "default",
73
- position: { x: 0, y: 0 },
74
- data: { label: "Test" }
75
- }
76
- });
77
- expect(html).toBeDefined();
78
- });
79
- it("should render with width and height fields in SSR", async () => {
80
- const html = await renderSSR(NodeEditPanel, {
81
- visible: true,
82
- node: {
83
- id: "node-1",
84
- type: "default",
85
- position: { x: 0, y: 0 },
86
- data: { label: "Sized Node" },
87
- width: 200,
88
- height: 100
89
- }
90
- });
91
- expect(html).toBeDefined();
92
- });
93
- it("should render with node ID field in SSR", async () => {
94
- const html = await renderSSR(NodeEditPanel, {
95
- visible: true,
96
- node: {
97
- id: "custom-node-id",
98
- type: "default",
99
- position: { x: 0, y: 0 },
100
- data: { label: "ID Node" }
101
- }
102
- });
103
- expect(html).toBeDefined();
104
- });
105
- it("should hydrate without mismatch", async () => {
106
- const result = await testHydration(NodeEditPanel, {
107
- visible: true,
108
- node: {
109
- id: "node-1",
110
- type: "default",
111
- position: { x: 0, y: 0 },
112
- data: { label: "Hydrate Test" }
113
- }
114
- });
115
- expect(result.ssrHtml).toBeDefined();
116
- expect(result.csrHtml).toBeDefined();
117
- });
118
- });
@@ -1,235 +0,0 @@
1
- "use strict";
2
-
3
- var _vitest = require("vitest");
4
- var _vue = require("vue");
5
- var _nodeGroup = require("../plugins/plugins/node-group.cjs");
6
- function createMockFlow(initialNodes = [], initialEdges = []) {
7
- const nodes = (0, _vue.ref)(initialNodes);
8
- const edges = (0, _vue.ref)(initialEdges);
9
- const flow = {
10
- nodes,
11
- edges,
12
- viewport: (0, _vue.ref)({
13
- x: 0,
14
- y: 0,
15
- zoom: 1
16
- }),
17
- addNode: _vitest.vi.fn(node => {
18
- nodes.value = [...nodes.value, node];
19
- }),
20
- removeNode: _vitest.vi.fn(id => {
21
- nodes.value = nodes.value.filter(n => n.id !== id);
22
- }),
23
- updateNode: _vitest.vi.fn((id, data) => {
24
- nodes.value = nodes.value.map(n => n.id === id ? {
25
- ...n,
26
- ...data
27
- } : n);
28
- }),
29
- getNode: _vitest.vi.fn(id => nodes.value.find(n => n.id === id)),
30
- addEdge: _vitest.vi.fn(),
31
- removeEdge: _vitest.vi.fn(),
32
- updateEdge: _vitest.vi.fn((id, data) => {
33
- edges.value = edges.value.map(e => e.id === id ? {
34
- ...e,
35
- ...data
36
- } : e);
37
- }),
38
- getEdge: _vitest.vi.fn(),
39
- setViewport: _vitest.vi.fn(),
40
- fitView: _vitest.vi.fn(),
41
- zoomIn: _vitest.vi.fn(),
42
- zoomOut: _vitest.vi.fn(),
43
- centerView: _vitest.vi.fn(),
44
- selectNode: _vitest.vi.fn(),
45
- selectEdge: _vitest.vi.fn(),
46
- clearSelection: _vitest.vi.fn(),
47
- getNodes: () => nodes.value,
48
- getEdges: () => edges.value,
49
- getViewport: () => ({
50
- x: 0,
51
- y: 0,
52
- zoom: 1
53
- }),
54
- screenToCanvas: _vitest.vi.fn().mockReturnValue({
55
- x: 0,
56
- y: 0
57
- }),
58
- canvasToScreen: _vitest.vi.fn().mockReturnValue({
59
- x: 0,
60
- y: 0
61
- }),
62
- on: _vitest.vi.fn(),
63
- off: _vitest.vi.fn(),
64
- emit: _vitest.vi.fn(),
65
- isValidConnection: _vitest.vi.fn().mockReturnValue(true),
66
- $el: void 0,
67
- draggingNodeId: (0, _vue.ref)(null),
68
- draggingPosition: (0, _vue.ref)(null),
69
- usePlugin: _vitest.vi.fn(),
70
- removePlugin: _vitest.vi.fn()
71
- };
72
- return flow;
73
- }
74
- (0, _vitest.describe)("createNodeGroupPlugin", () => {
75
- (0, _vitest.it)("should be created with correct metadata", () => {
76
- const plugin = (0, _nodeGroup.createNodeGroupPlugin)();
77
- (0, _vitest.expect)(plugin.id).toBe("node-group");
78
- (0, _vitest.expect)(plugin.name).toBe("NodeGroup");
79
- });
80
- (0, _vitest.it)("should expose groupSelectedNodes on flow instance after install", () => {
81
- const flow = createMockFlow();
82
- const plugin = (0, _nodeGroup.createNodeGroupPlugin)();
83
- plugin.install(flow);
84
- (0, _vitest.expect)(typeof flow.groupSelectedNodes).toBe("function");
85
- (0, _vitest.expect)(typeof flow.ungroupNodes).toBe("function");
86
- (0, _vitest.expect)(typeof flow.toggleGroupCollapse).toBe("function");
87
- (0, _vitest.expect)(typeof flow.isGroupCollapsed).toBe("function");
88
- (0, _vitest.expect)(typeof flow.getGroupChildren).toBe("function");
89
- (0, _vitest.expect)(typeof flow.getGroupRegistry).toBe("function");
90
- });
91
- (0, _vitest.it)("should return null when fewer than 2 nodes are selected", () => {
92
- const nodes = [{
93
- id: "1",
94
- type: "default",
95
- position: {
96
- x: 0,
97
- y: 0
98
- },
99
- data: {},
100
- selected: true
101
- }];
102
- const flow = createMockFlow(nodes);
103
- const plugin = (0, _nodeGroup.createNodeGroupPlugin)();
104
- plugin.install(flow);
105
- const result = flow.groupSelectedNodes;
106
- (0, _vitest.expect)(result()).toBeNull();
107
- });
108
- (0, _vitest.it)("should create a group node when 2+ nodes are selected", () => {
109
- const nodes = [{
110
- id: "1",
111
- type: "default",
112
- position: {
113
- x: 100,
114
- y: 100
115
- },
116
- data: {},
117
- selected: true,
118
- width: 150,
119
- height: 50
120
- }, {
121
- id: "2",
122
- type: "default",
123
- position: {
124
- x: 300,
125
- y: 100
126
- },
127
- data: {},
128
- selected: true,
129
- width: 150,
130
- height: 50
131
- }];
132
- const flow = createMockFlow(nodes);
133
- const plugin = (0, _nodeGroup.createNodeGroupPlugin)({
134
- groupIdPrefix: "grp"
135
- });
136
- plugin.install(flow);
137
- const groupSelected = flow.groupSelectedNodes;
138
- const groupId = groupSelected("Test Group");
139
- (0, _vitest.expect)(groupId).toBeTruthy();
140
- (0, _vitest.expect)(groupId).toMatch(/^grp-/);
141
- (0, _vitest.expect)(flow.addNode).toHaveBeenCalled();
142
- });
143
- (0, _vitest.it)("should register group info in registry after grouping", () => {
144
- const nodes = [{
145
- id: "a",
146
- type: "default",
147
- position: {
148
- x: 50,
149
- y: 50
150
- },
151
- data: {},
152
- selected: true,
153
- width: 100,
154
- height: 50
155
- }, {
156
- id: "b",
157
- type: "default",
158
- position: {
159
- x: 200,
160
- y: 50
161
- },
162
- data: {},
163
- selected: true,
164
- width: 100,
165
- height: 50
166
- }];
167
- const flow = createMockFlow(nodes);
168
- const plugin = (0, _nodeGroup.createNodeGroupPlugin)();
169
- plugin.install(flow);
170
- const groupSelected = flow.groupSelectedNodes;
171
- const groupId = groupSelected();
172
- const registry = flow.getGroupRegistry();
173
- (0, _vitest.expect)(registry.has(groupId)).toBe(true);
174
- });
175
- (0, _vitest.it)("should toggle group collapse and hide children", () => {
176
- const childNodes = [{
177
- id: "c1",
178
- type: "default",
179
- position: {
180
- x: 20,
181
- y: 20
182
- },
183
- data: {},
184
- parentId: "group-1",
185
- width: 100,
186
- height: 40
187
- }];
188
- const flow = createMockFlow(childNodes);
189
- const plugin = (0, _nodeGroup.createNodeGroupPlugin)();
190
- plugin.install(flow);
191
- const registry = flow.getGroupRegistry();
192
- registry.set("group-1", {
193
- groupId: "group-1",
194
- childIds: ["c1"],
195
- collapsed: false,
196
- originalPositions: {}
197
- });
198
- flow.nodes.value.push({
199
- id: "group-1",
200
- type: "group",
201
- position: {
202
- x: 0,
203
- y: 0
204
- },
205
- data: {},
206
- style: {
207
- width: 200,
208
- height: 150
209
- },
210
- width: 200,
211
- height: 150
212
- });
213
- const toggleCollapse = flow.toggleGroupCollapse;
214
- toggleCollapse("group-1");
215
- (0, _vitest.expect)(flow.updateNode).toHaveBeenCalledWith("c1", _vitest.expect.objectContaining({
216
- hidden: true
217
- }));
218
- });
219
- (0, _vitest.it)("should cleanup registry on destroy", () => {
220
- const flow = createMockFlow();
221
- const plugin = (0, _nodeGroup.createNodeGroupPlugin)();
222
- plugin.install(flow);
223
- plugin.destroy?.();
224
- const registry = flow.getGroupRegistry();
225
- (0, _vitest.expect)(registry.size).toBe(0);
226
- });
227
- (0, _vitest.it)("should not install when disabled", () => {
228
- const flow = createMockFlow();
229
- const plugin = (0, _nodeGroup.createNodeGroupPlugin)({
230
- enabled: false
231
- });
232
- plugin.install(flow);
233
- (0, _vitest.expect)(flow.groupSelectedNodes).toBeUndefined();
234
- });
235
- });
@@ -1 +0,0 @@
1
- export {};