@yh-ui/flow 0.1.21
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/LICENSE +21 -0
- package/README.md +234 -0
- package/dist/Flow.d.vue.ts +306 -0
- package/dist/Flow.vue +959 -0
- package/dist/Flow.vue.d.ts +306 -0
- package/dist/__tests__/ai-workflow.ssr.test.cjs +352 -0
- package/dist/__tests__/ai-workflow.ssr.test.d.ts +1 -0
- package/dist/__tests__/ai-workflow.ssr.test.mjs +283 -0
- package/dist/__tests__/ai-workflow.test.cjs +109 -0
- package/dist/__tests__/ai-workflow.test.d.ts +1 -0
- package/dist/__tests__/ai-workflow.test.mjs +112 -0
- package/dist/__tests__/bpmn.ssr.test.cjs +278 -0
- package/dist/__tests__/bpmn.ssr.test.d.ts +1 -0
- package/dist/__tests__/bpmn.ssr.test.mjs +237 -0
- package/dist/__tests__/bpmn.test.cjs +103 -0
- package/dist/__tests__/bpmn.test.d.ts +1 -0
- package/dist/__tests__/bpmn.test.mjs +106 -0
- package/dist/__tests__/custom-types.test.cjs +300 -0
- package/dist/__tests__/custom-types.test.d.ts +1 -0
- package/dist/__tests__/custom-types.test.mjs +248 -0
- package/dist/__tests__/edge.test.cjs +56 -0
- package/dist/__tests__/edge.test.d.ts +1 -0
- package/dist/__tests__/edge.test.mjs +69 -0
- package/dist/__tests__/event-bus.test.cjs +80 -0
- package/dist/__tests__/event-bus.test.d.ts +1 -0
- package/dist/__tests__/event-bus.test.mjs +51 -0
- package/dist/__tests__/flow.ssr.test.cjs +156 -0
- package/dist/__tests__/flow.ssr.test.d.ts +1 -0
- package/dist/__tests__/flow.ssr.test.mjs +112 -0
- package/dist/__tests__/geometry.test.cjs +191 -0
- package/dist/__tests__/geometry.test.d.ts +1 -0
- package/dist/__tests__/geometry.test.mjs +105 -0
- package/dist/__tests__/graph.test.cjs +115 -0
- package/dist/__tests__/graph.test.d.ts +1 -0
- package/dist/__tests__/graph.test.mjs +85 -0
- package/dist/__tests__/history-plugin.test.cjs +191 -0
- package/dist/__tests__/history-plugin.test.d.ts +1 -0
- package/dist/__tests__/history-plugin.test.mjs +161 -0
- package/dist/__tests__/history.test.cjs +81 -0
- package/dist/__tests__/history.test.d.ts +1 -0
- package/dist/__tests__/history.test.mjs +43 -0
- package/dist/__tests__/layout.test.cjs +213 -0
- package/dist/__tests__/layout.test.d.ts +1 -0
- package/dist/__tests__/layout.test.mjs +170 -0
- package/dist/__tests__/node-edit-panel.ssr.test.cjs +168 -0
- package/dist/__tests__/node-edit-panel.ssr.test.d.ts +1 -0
- package/dist/__tests__/node-edit-panel.ssr.test.mjs +118 -0
- package/dist/__tests__/node-group-plugin.test.cjs +235 -0
- package/dist/__tests__/node-group-plugin.test.d.ts +1 -0
- package/dist/__tests__/node-group-plugin.test.mjs +187 -0
- package/dist/__tests__/node-handles.test.cjs +340 -0
- package/dist/__tests__/node-handles.test.d.ts +1 -0
- package/dist/__tests__/node-handles.test.mjs +230 -0
- package/dist/__tests__/plugin.test.cjs +151 -0
- package/dist/__tests__/plugin.test.d.ts +1 -0
- package/dist/__tests__/plugin.test.mjs +116 -0
- package/dist/__tests__/transform.test.cjs +58 -0
- package/dist/__tests__/transform.test.d.ts +1 -0
- package/dist/__tests__/transform.test.mjs +38 -0
- package/dist/__tests__/useAlignment.test.cjs +91 -0
- package/dist/__tests__/useAlignment.test.d.ts +1 -0
- package/dist/__tests__/useAlignment.test.mjs +52 -0
- package/dist/__tests__/useEdges.test.cjs +117 -0
- package/dist/__tests__/useEdges.test.d.ts +1 -0
- package/dist/__tests__/useEdges.test.mjs +80 -0
- package/dist/__tests__/useKeyboard.test.cjs +88 -0
- package/dist/__tests__/useKeyboard.test.d.ts +1 -0
- package/dist/__tests__/useKeyboard.test.mjs +56 -0
- package/dist/__tests__/useNodes.test.cjs +150 -0
- package/dist/__tests__/useNodes.test.d.ts +1 -0
- package/dist/__tests__/useNodes.test.mjs +80 -0
- package/dist/__tests__/useSelection.test.cjs +112 -0
- package/dist/__tests__/useSelection.test.d.ts +1 -0
- package/dist/__tests__/useSelection.test.mjs +76 -0
- package/dist/__tests__/useViewport.test.cjs +171 -0
- package/dist/__tests__/useViewport.test.d.ts +1 -0
- package/dist/__tests__/useViewport.test.mjs +82 -0
- package/dist/__tests__/utils/ssr.cjs +124 -0
- package/dist/__tests__/utils/ssr.d.ts +33 -0
- package/dist/__tests__/utils/ssr.mjs +129 -0
- package/dist/__tests__/validation.test.cjs +95 -0
- package/dist/__tests__/validation.test.d.ts +1 -0
- package/dist/__tests__/validation.test.mjs +36 -0
- package/dist/components/AiNodeEditPanel.d.vue.ts +13 -0
- package/dist/components/AiNodeEditPanel.vue +413 -0
- package/dist/components/AiNodeEditPanel.vue.d.ts +13 -0
- package/dist/components/EdgeEditPanel.d.vue.ts +14 -0
- package/dist/components/EdgeEditPanel.vue +205 -0
- package/dist/components/EdgeEditPanel.vue.d.ts +14 -0
- package/dist/components/NodeEditPanel.d.vue.ts +13 -0
- package/dist/components/NodeEditPanel.vue +214 -0
- package/dist/components/NodeEditPanel.vue.d.ts +13 -0
- package/dist/components/edges/BaseEdge.d.vue.ts +23 -0
- package/dist/components/edges/BaseEdge.vue +55 -0
- package/dist/components/edges/BaseEdge.vue.d.ts +23 -0
- package/dist/components/edges/BezierEdge.d.vue.ts +22 -0
- package/dist/components/edges/BezierEdge.vue +57 -0
- package/dist/components/edges/BezierEdge.vue.d.ts +22 -0
- package/dist/components/edges/DataFlowEdge.d.vue.ts +41 -0
- package/dist/components/edges/DataFlowEdge.vue +211 -0
- package/dist/components/edges/DataFlowEdge.vue.d.ts +41 -0
- package/dist/components/edges/SmoothEdge.d.vue.ts +22 -0
- package/dist/components/edges/SmoothEdge.vue +53 -0
- package/dist/components/edges/SmoothEdge.vue.d.ts +22 -0
- package/dist/components/edges/StepEdge.d.vue.ts +22 -0
- package/dist/components/edges/StepEdge.vue +42 -0
- package/dist/components/edges/StepEdge.vue.d.ts +22 -0
- package/dist/components/edges/index.cjs +41 -0
- package/dist/components/edges/index.d.ts +5 -0
- package/dist/components/edges/index.mjs +5 -0
- package/dist/components/nodes/BaseNode.d.vue.ts +25 -0
- package/dist/components/nodes/BaseNode.vue +93 -0
- package/dist/components/nodes/BaseNode.vue.d.ts +25 -0
- package/dist/components/nodes/CustomNode.d.vue.ts +36 -0
- package/dist/components/nodes/CustomNode.vue +44 -0
- package/dist/components/nodes/CustomNode.vue.d.ts +36 -0
- package/dist/components/nodes/DatabaseNode.d.vue.ts +19 -0
- package/dist/components/nodes/DatabaseNode.vue +62 -0
- package/dist/components/nodes/DatabaseNode.vue.d.ts +19 -0
- package/dist/components/nodes/DiamondNode.d.vue.ts +19 -0
- package/dist/components/nodes/DiamondNode.vue +62 -0
- package/dist/components/nodes/DiamondNode.vue.d.ts +19 -0
- package/dist/components/nodes/GroupNode.d.vue.ts +31 -0
- package/dist/components/nodes/GroupNode.vue +48 -0
- package/dist/components/nodes/GroupNode.vue.d.ts +31 -0
- package/dist/components/nodes/InputNode.d.vue.ts +23 -0
- package/dist/components/nodes/InputNode.vue +63 -0
- package/dist/components/nodes/InputNode.vue.d.ts +23 -0
- package/dist/components/nodes/NodeResizer.d.vue.ts +27 -0
- package/dist/components/nodes/NodeResizer.vue +89 -0
- package/dist/components/nodes/NodeResizer.vue.d.ts +27 -0
- package/dist/components/nodes/NodeToolbar.d.vue.ts +32 -0
- package/dist/components/nodes/NodeToolbar.vue +101 -0
- package/dist/components/nodes/NodeToolbar.vue.d.ts +32 -0
- package/dist/components/nodes/OutputNode.d.vue.ts +21 -0
- package/dist/components/nodes/OutputNode.vue +53 -0
- package/dist/components/nodes/OutputNode.vue.d.ts +21 -0
- package/dist/components/nodes/ai-workflow/AiAgentNode.d.vue.ts +20 -0
- package/dist/components/nodes/ai-workflow/AiAgentNode.vue +59 -0
- package/dist/components/nodes/ai-workflow/AiAgentNode.vue.d.ts +20 -0
- package/dist/components/nodes/ai-workflow/AiConditionNode.d.vue.ts +19 -0
- package/dist/components/nodes/ai-workflow/AiConditionNode.vue +65 -0
- package/dist/components/nodes/ai-workflow/AiConditionNode.vue.d.ts +19 -0
- package/dist/components/nodes/ai-workflow/AiEndNode.d.vue.ts +19 -0
- package/dist/components/nodes/ai-workflow/AiEndNode.vue +47 -0
- package/dist/components/nodes/ai-workflow/AiEndNode.vue.d.ts +19 -0
- package/dist/components/nodes/ai-workflow/AiLlmNode.d.vue.ts +19 -0
- package/dist/components/nodes/ai-workflow/AiLlmNode.vue +64 -0
- package/dist/components/nodes/ai-workflow/AiLlmNode.vue.d.ts +19 -0
- package/dist/components/nodes/ai-workflow/AiMemoryNode.d.vue.ts +19 -0
- package/dist/components/nodes/ai-workflow/AiMemoryNode.vue +59 -0
- package/dist/components/nodes/ai-workflow/AiMemoryNode.vue.d.ts +19 -0
- package/dist/components/nodes/ai-workflow/AiPromptNode.d.vue.ts +19 -0
- package/dist/components/nodes/ai-workflow/AiPromptNode.vue +61 -0
- package/dist/components/nodes/ai-workflow/AiPromptNode.vue.d.ts +19 -0
- package/dist/components/nodes/ai-workflow/AiStartNode.d.vue.ts +19 -0
- package/dist/components/nodes/ai-workflow/AiStartNode.vue +47 -0
- package/dist/components/nodes/ai-workflow/AiStartNode.vue.d.ts +19 -0
- package/dist/components/nodes/ai-workflow/AiToolNode.d.vue.ts +19 -0
- package/dist/components/nodes/ai-workflow/AiToolNode.vue +59 -0
- package/dist/components/nodes/ai-workflow/AiToolNode.vue.d.ts +19 -0
- package/dist/components/nodes/ai-workflow/index.cjs +109 -0
- package/dist/components/nodes/ai-workflow/index.d.ts +23 -0
- package/dist/components/nodes/ai-workflow/index.mjs +37 -0
- package/dist/components/nodes/bpmn/BpmnEndEvent.d.vue.ts +19 -0
- package/dist/components/nodes/bpmn/BpmnEndEvent.vue +50 -0
- package/dist/components/nodes/bpmn/BpmnEndEvent.vue.d.ts +19 -0
- package/dist/components/nodes/bpmn/BpmnExclusiveGateway.d.vue.ts +19 -0
- package/dist/components/nodes/bpmn/BpmnExclusiveGateway.vue +60 -0
- package/dist/components/nodes/bpmn/BpmnExclusiveGateway.vue.d.ts +19 -0
- package/dist/components/nodes/bpmn/BpmnInclusiveGateway.d.vue.ts +19 -0
- package/dist/components/nodes/bpmn/BpmnInclusiveGateway.vue +60 -0
- package/dist/components/nodes/bpmn/BpmnInclusiveGateway.vue.d.ts +19 -0
- package/dist/components/nodes/bpmn/BpmnParallelGateway.d.vue.ts +19 -0
- package/dist/components/nodes/bpmn/BpmnParallelGateway.vue +60 -0
- package/dist/components/nodes/bpmn/BpmnParallelGateway.vue.d.ts +19 -0
- package/dist/components/nodes/bpmn/BpmnServiceTask.d.vue.ts +19 -0
- package/dist/components/nodes/bpmn/BpmnServiceTask.vue +55 -0
- package/dist/components/nodes/bpmn/BpmnServiceTask.vue.d.ts +19 -0
- package/dist/components/nodes/bpmn/BpmnStartEvent.d.vue.ts +19 -0
- package/dist/components/nodes/bpmn/BpmnStartEvent.vue +50 -0
- package/dist/components/nodes/bpmn/BpmnStartEvent.vue.d.ts +19 -0
- package/dist/components/nodes/bpmn/BpmnTask.d.vue.ts +19 -0
- package/dist/components/nodes/bpmn/BpmnTask.vue +54 -0
- package/dist/components/nodes/bpmn/BpmnTask.vue.d.ts +19 -0
- package/dist/components/nodes/bpmn/BpmnUserTask.d.vue.ts +19 -0
- package/dist/components/nodes/bpmn/BpmnUserTask.vue +55 -0
- package/dist/components/nodes/bpmn/BpmnUserTask.vue.d.ts +19 -0
- package/dist/components/nodes/bpmn/index.cjs +109 -0
- package/dist/components/nodes/bpmn/index.d.ts +23 -0
- package/dist/components/nodes/bpmn/index.mjs +37 -0
- package/dist/components/nodes/index.cjs +246 -0
- package/dist/components/nodes/index.d.ts +13 -0
- package/dist/components/nodes/index.mjs +44 -0
- package/dist/core/FlowContext.cjs +21 -0
- package/dist/core/FlowContext.d.ts +10 -0
- package/dist/core/FlowContext.mjs +13 -0
- package/dist/core/index.cjs +104 -0
- package/dist/core/index.d.ts +9 -0
- package/dist/core/index.mjs +9 -0
- package/dist/core/useAlignment.cjs +81 -0
- package/dist/core/useAlignment.d.ts +33 -0
- package/dist/core/useAlignment.mjs +71 -0
- package/dist/core/useEdges.cjs +132 -0
- package/dist/core/useEdges.d.ts +29 -0
- package/dist/core/useEdges.mjs +89 -0
- package/dist/core/useFlow.cjs +40 -0
- package/dist/core/useFlow.d.ts +31 -0
- package/dist/core/useFlow.mjs +32 -0
- package/dist/core/useHistory.cjs +63 -0
- package/dist/core/useHistory.d.ts +15 -0
- package/dist/core/useHistory.mjs +54 -0
- package/dist/core/useKeyboard.cjs +54 -0
- package/dist/core/useKeyboard.d.ts +18 -0
- package/dist/core/useKeyboard.mjs +45 -0
- package/dist/core/useNodeDistribution.cjs +171 -0
- package/dist/core/useNodeDistribution.d.ts +12 -0
- package/dist/core/useNodeDistribution.mjs +145 -0
- package/dist/core/useNodes.cjs +146 -0
- package/dist/core/useNodes.d.ts +26 -0
- package/dist/core/useNodes.mjs +101 -0
- package/dist/core/useSelection.cjs +83 -0
- package/dist/core/useSelection.d.ts +18 -0
- package/dist/core/useSelection.mjs +53 -0
- package/dist/core/useViewport.cjs +157 -0
- package/dist/core/useViewport.d.ts +65 -0
- package/dist/core/useViewport.mjs +125 -0
- package/dist/flow.cjs +240 -0
- package/dist/flow.d.ts +276 -0
- package/dist/flow.mjs +230 -0
- package/dist/index.cjs +378 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.mjs +50 -0
- package/dist/plugins/index.cjs +96 -0
- package/dist/plugins/index.d.ts +34 -0
- package/dist/plugins/index.mjs +47 -0
- package/dist/plugins/plugin.cjs +117 -0
- package/dist/plugins/plugin.d.ts +72 -0
- package/dist/plugins/plugin.mjs +110 -0
- package/dist/plugins/plugins/controls.cjs +38 -0
- package/dist/plugins/plugins/controls.d.ts +12 -0
- package/dist/plugins/plugins/controls.mjs +28 -0
- package/dist/plugins/plugins/export.cjs +102 -0
- package/dist/plugins/plugins/export.d.ts +12 -0
- package/dist/plugins/plugins/export.mjs +89 -0
- package/dist/plugins/plugins/grid.cjs +36 -0
- package/dist/plugins/plugins/grid.d.ts +11 -0
- package/dist/plugins/plugins/grid.mjs +26 -0
- package/dist/plugins/plugins/history.cjs +140 -0
- package/dist/plugins/plugins/history.d.ts +53 -0
- package/dist/plugins/plugins/history.mjs +132 -0
- package/dist/plugins/plugins/index.cjs +104 -0
- package/dist/plugins/plugins/index.d.ts +9 -0
- package/dist/plugins/plugins/index.mjs +9 -0
- package/dist/plugins/plugins/keyboard.cjs +27 -0
- package/dist/plugins/plugins/keyboard.d.ts +10 -0
- package/dist/plugins/plugins/keyboard.mjs +18 -0
- package/dist/plugins/plugins/layout.cjs +275 -0
- package/dist/plugins/plugins/layout.d.ts +34 -0
- package/dist/plugins/plugins/layout.mjs +246 -0
- package/dist/plugins/plugins/minimap.cjs +60 -0
- package/dist/plugins/plugins/minimap.d.ts +25 -0
- package/dist/plugins/plugins/minimap.mjs +50 -0
- package/dist/plugins/plugins/node-group.cjs +209 -0
- package/dist/plugins/plugins/node-group.d.ts +26 -0
- package/dist/plugins/plugins/node-group.mjs +178 -0
- package/dist/plugins/plugins/snap.cjs +36 -0
- package/dist/plugins/plugins/snap.d.ts +12 -0
- package/dist/plugins/plugins/snap.mjs +26 -0
- package/dist/renderer/AlignmentLines.d.vue.ts +5 -0
- package/dist/renderer/AlignmentLines.vue +113 -0
- package/dist/renderer/AlignmentLines.vue.d.ts +5 -0
- package/dist/renderer/Background.d.vue.ts +7 -0
- package/dist/renderer/Background.vue +86 -0
- package/dist/renderer/Background.vue.d.ts +7 -0
- package/dist/renderer/Controls.d.vue.ts +13 -0
- package/dist/renderer/Controls.vue +82 -0
- package/dist/renderer/Controls.vue.d.ts +13 -0
- package/dist/renderer/EdgeHandlesRenderer.d.vue.ts +11 -0
- package/dist/renderer/EdgeHandlesRenderer.vue +75 -0
- package/dist/renderer/EdgeHandlesRenderer.vue.d.ts +11 -0
- package/dist/renderer/EdgeRenderer.d.vue.ts +39 -0
- package/dist/renderer/EdgeRenderer.vue +204 -0
- package/dist/renderer/EdgeRenderer.vue.d.ts +39 -0
- package/dist/renderer/FlowBackground.d.vue.ts +11 -0
- package/dist/renderer/FlowBackground.vue +82 -0
- package/dist/renderer/FlowBackground.vue.d.ts +11 -0
- package/dist/renderer/Minimap.d.vue.ts +30 -0
- package/dist/renderer/Minimap.vue +290 -0
- package/dist/renderer/Minimap.vue.d.ts +30 -0
- package/dist/renderer/NodeRenderer.d.vue.ts +56 -0
- package/dist/renderer/NodeRenderer.vue +328 -0
- package/dist/renderer/NodeRenderer.vue.d.ts +56 -0
- package/dist/renderer/SelectionBox.d.vue.ts +11 -0
- package/dist/renderer/SelectionBox.vue +28 -0
- package/dist/renderer/SelectionBox.vue.d.ts +11 -0
- package/dist/types/edge.cjs +13 -0
- package/dist/types/edge.d.ts +65 -0
- package/dist/types/edge.mjs +6 -0
- package/dist/types/events.cjs +1 -0
- package/dist/types/events.d.ts +115 -0
- package/dist/types/events.mjs +0 -0
- package/dist/types/index.cjs +1 -0
- package/dist/types/index.d.ts +366 -0
- package/dist/types/index.mjs +0 -0
- package/dist/types/node.cjs +9 -0
- package/dist/types/node.d.ts +90 -0
- package/dist/types/node.mjs +3 -0
- package/dist/types/viewport.cjs +42 -0
- package/dist/types/viewport.d.ts +62 -0
- package/dist/types/viewport.mjs +36 -0
- package/dist/utils/bpmn-engine.cjs +390 -0
- package/dist/utils/bpmn-engine.d.ts +164 -0
- package/dist/utils/bpmn-engine.mjs +378 -0
- package/dist/utils/bpmn.cjs +492 -0
- package/dist/utils/bpmn.d.ts +53 -0
- package/dist/utils/bpmn.mjs +430 -0
- package/dist/utils/collaboration.cjs +537 -0
- package/dist/utils/collaboration.d.ts +189 -0
- package/dist/utils/collaboration.mjs +521 -0
- package/dist/utils/custom-types.cjs +138 -0
- package/dist/utils/custom-types.d.ts +78 -0
- package/dist/utils/custom-types.mjs +108 -0
- package/dist/utils/edge.cjs +235 -0
- package/dist/utils/edge.d.ts +79 -0
- package/dist/utils/edge.mjs +172 -0
- package/dist/utils/event-bus.cjs +91 -0
- package/dist/utils/event-bus.d.ts +39 -0
- package/dist/utils/event-bus.mjs +82 -0
- package/dist/utils/geometry.cjs +178 -0
- package/dist/utils/geometry.d.ts +186 -0
- package/dist/utils/geometry.mjs +144 -0
- package/dist/utils/graph.cjs +158 -0
- package/dist/utils/graph.d.ts +40 -0
- package/dist/utils/graph.mjs +147 -0
- package/dist/utils/index.cjs +137 -0
- package/dist/utils/index.d.ts +12 -0
- package/dist/utils/index.mjs +12 -0
- package/dist/utils/performance.cjs +94 -0
- package/dist/utils/performance.d.ts +18 -0
- package/dist/utils/performance.mjs +82 -0
- package/dist/utils/screenshot.cjs +87 -0
- package/dist/utils/screenshot.d.ts +22 -0
- package/dist/utils/screenshot.mjs +66 -0
- package/dist/utils/theme.cjs +228 -0
- package/dist/utils/theme.d.ts +92 -0
- package/dist/utils/theme.mjs +217 -0
- package/dist/utils/transform.cjs +76 -0
- package/dist/utils/transform.d.ts +45 -0
- package/dist/utils/transform.mjs +57 -0
- package/dist/utils/validation.cjs +107 -0
- package/dist/utils/validation.d.ts +29 -0
- package/dist/utils/validation.mjs +85 -0
- package/package.json +61 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _vitest = require("vitest");
|
|
4
|
+
var _edge = require("../utils/edge.cjs");
|
|
5
|
+
const params = {
|
|
6
|
+
sourceX: 0,
|
|
7
|
+
sourceY: 0,
|
|
8
|
+
targetX: 100,
|
|
9
|
+
targetY: 80,
|
|
10
|
+
sourcePosition: "right",
|
|
11
|
+
targetPosition: "left"
|
|
12
|
+
};
|
|
13
|
+
(0, _vitest.describe)("flow/utils/edge", () => {
|
|
14
|
+
(0, _vitest.it)("getStraightPath should return M and L", () => {
|
|
15
|
+
const d = (0, _edge.getStraightPath)(params);
|
|
16
|
+
(0, _vitest.expect)(d).toMatch(/^M\d+,\d+\s+L\d+,\d+$/);
|
|
17
|
+
(0, _vitest.expect)(d).toContain("M0,0");
|
|
18
|
+
(0, _vitest.expect)(d).toContain("L100,80");
|
|
19
|
+
});
|
|
20
|
+
(0, _vitest.it)("getBezierPath should return M and C", () => {
|
|
21
|
+
const d = (0, _edge.getBezierPath)(params);
|
|
22
|
+
(0, _vitest.expect)(d).toMatch(/^M\d+,\d+\s+C[\d.,\s]+$/);
|
|
23
|
+
(0, _vitest.expect)(d).toContain("M0,0");
|
|
24
|
+
(0, _vitest.expect)(d).toContain("C");
|
|
25
|
+
});
|
|
26
|
+
(0, _vitest.it)("getStepPath should return path with L segments", () => {
|
|
27
|
+
const d = (0, _edge.getStepPath)(params);
|
|
28
|
+
(0, _vitest.expect)(d).toMatch(/^M[\d.,]+(?:\s+L[\d.,]+)+$/);
|
|
29
|
+
});
|
|
30
|
+
(0, _vitest.it)("getSmoothStepPath should return path with M and L", () => {
|
|
31
|
+
const d = (0, _edge.getSmoothStepPath)(params);
|
|
32
|
+
(0, _vitest.expect)(d).toContain("M");
|
|
33
|
+
(0, _vitest.expect)(d).toContain("L");
|
|
34
|
+
});
|
|
35
|
+
(0, _vitest.it)("getEdgePath should dispatch by type", () => {
|
|
36
|
+
(0, _vitest.expect)((0, _edge.getEdgePath)("straight", params)).toContain("L");
|
|
37
|
+
(0, _vitest.expect)((0, _edge.getEdgePath)("bezier", params)).toContain("C");
|
|
38
|
+
(0, _vitest.expect)((0, _edge.getEdgePath)("step", params)).toContain("M");
|
|
39
|
+
(0, _vitest.expect)((0, _edge.getEdgePath)("smoothstep", params)).toContain("M");
|
|
40
|
+
(0, _vitest.expect)((0, _edge.getEdgePath)("default", params)).toContain("C");
|
|
41
|
+
});
|
|
42
|
+
(0, _vitest.it)("getEdgeCenter should return midpoint", () => {
|
|
43
|
+
const c = (0, _edge.getEdgeCenter)(params);
|
|
44
|
+
(0, _vitest.expect)(c.x).toBe(50);
|
|
45
|
+
(0, _vitest.expect)(c.y).toBe(40);
|
|
46
|
+
(0, _vitest.expect)(c.ox).toBe(50);
|
|
47
|
+
(0, _vitest.expect)(c.oy).toBe(40);
|
|
48
|
+
});
|
|
49
|
+
(0, _vitest.it)("getEdgePosition should return source/target with direction offset", () => {
|
|
50
|
+
const pos = (0, _edge.getEdgePosition)(params.sourceX, params.sourceY, params.targetX, params.targetY, params.sourcePosition, params.targetPosition);
|
|
51
|
+
(0, _vitest.expect)(pos).toHaveProperty("sx");
|
|
52
|
+
(0, _vitest.expect)(pos).toHaveProperty("sy");
|
|
53
|
+
(0, _vitest.expect)(pos).toHaveProperty("tx");
|
|
54
|
+
(0, _vitest.expect)(pos).toHaveProperty("ty");
|
|
55
|
+
});
|
|
56
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { describe, it, expect } from "vitest";
|
|
2
|
+
import {
|
|
3
|
+
getEdgePath,
|
|
4
|
+
getStraightPath,
|
|
5
|
+
getBezierPath,
|
|
6
|
+
getStepPath,
|
|
7
|
+
getSmoothStepPath,
|
|
8
|
+
getEdgeCenter,
|
|
9
|
+
getEdgePosition
|
|
10
|
+
} from "../utils/edge.mjs";
|
|
11
|
+
const params = {
|
|
12
|
+
sourceX: 0,
|
|
13
|
+
sourceY: 0,
|
|
14
|
+
targetX: 100,
|
|
15
|
+
targetY: 80,
|
|
16
|
+
sourcePosition: "right",
|
|
17
|
+
targetPosition: "left"
|
|
18
|
+
};
|
|
19
|
+
describe("flow/utils/edge", () => {
|
|
20
|
+
it("getStraightPath should return M and L", () => {
|
|
21
|
+
const d = getStraightPath(params);
|
|
22
|
+
expect(d).toMatch(/^M\d+,\d+\s+L\d+,\d+$/);
|
|
23
|
+
expect(d).toContain("M0,0");
|
|
24
|
+
expect(d).toContain("L100,80");
|
|
25
|
+
});
|
|
26
|
+
it("getBezierPath should return M and C", () => {
|
|
27
|
+
const d = getBezierPath(params);
|
|
28
|
+
expect(d).toMatch(/^M\d+,\d+\s+C[\d.,\s]+$/);
|
|
29
|
+
expect(d).toContain("M0,0");
|
|
30
|
+
expect(d).toContain("C");
|
|
31
|
+
});
|
|
32
|
+
it("getStepPath should return path with L segments", () => {
|
|
33
|
+
const d = getStepPath(params);
|
|
34
|
+
expect(d).toMatch(/^M[\d.,]+(?:\s+L[\d.,]+)+$/);
|
|
35
|
+
});
|
|
36
|
+
it("getSmoothStepPath should return path with M and L", () => {
|
|
37
|
+
const d = getSmoothStepPath(params);
|
|
38
|
+
expect(d).toContain("M");
|
|
39
|
+
expect(d).toContain("L");
|
|
40
|
+
});
|
|
41
|
+
it("getEdgePath should dispatch by type", () => {
|
|
42
|
+
expect(getEdgePath("straight", params)).toContain("L");
|
|
43
|
+
expect(getEdgePath("bezier", params)).toContain("C");
|
|
44
|
+
expect(getEdgePath("step", params)).toContain("M");
|
|
45
|
+
expect(getEdgePath("smoothstep", params)).toContain("M");
|
|
46
|
+
expect(getEdgePath("default", params)).toContain("C");
|
|
47
|
+
});
|
|
48
|
+
it("getEdgeCenter should return midpoint", () => {
|
|
49
|
+
const c = getEdgeCenter(params);
|
|
50
|
+
expect(c.x).toBe(50);
|
|
51
|
+
expect(c.y).toBe(40);
|
|
52
|
+
expect(c.ox).toBe(50);
|
|
53
|
+
expect(c.oy).toBe(40);
|
|
54
|
+
});
|
|
55
|
+
it("getEdgePosition should return source/target with direction offset", () => {
|
|
56
|
+
const pos = getEdgePosition(
|
|
57
|
+
params.sourceX,
|
|
58
|
+
params.sourceY,
|
|
59
|
+
params.targetX,
|
|
60
|
+
params.targetY,
|
|
61
|
+
params.sourcePosition,
|
|
62
|
+
params.targetPosition
|
|
63
|
+
);
|
|
64
|
+
expect(pos).toHaveProperty("sx");
|
|
65
|
+
expect(pos).toHaveProperty("sy");
|
|
66
|
+
expect(pos).toHaveProperty("tx");
|
|
67
|
+
expect(pos).toHaveProperty("ty");
|
|
68
|
+
});
|
|
69
|
+
});
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _vitest = require("vitest");
|
|
4
|
+
var _eventBus = require("../utils/event-bus.cjs");
|
|
5
|
+
(0, _vitest.describe)("flow/utils/event-bus", () => {
|
|
6
|
+
(0, _vitest.it)("should subscribe and emit", () => {
|
|
7
|
+
const bus = (0, _eventBus.createEventBus)();
|
|
8
|
+
const fn = _vitest.vi.fn();
|
|
9
|
+
bus.on("viewport:change", fn);
|
|
10
|
+
bus.emit("viewport:change", {
|
|
11
|
+
transform: {
|
|
12
|
+
x: 10,
|
|
13
|
+
y: 20,
|
|
14
|
+
zoom: 1
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
(0, _vitest.expect)(fn).toHaveBeenCalledTimes(1);
|
|
18
|
+
(0, _vitest.expect)(fn).toHaveBeenCalledWith({
|
|
19
|
+
transform: {
|
|
20
|
+
x: 10,
|
|
21
|
+
y: 20,
|
|
22
|
+
zoom: 1
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
(0, _vitest.it)("should off unsubscribe", () => {
|
|
27
|
+
const bus = (0, _eventBus.createEventBus)();
|
|
28
|
+
const fn = _vitest.vi.fn();
|
|
29
|
+
bus.on("viewport:change", fn);
|
|
30
|
+
bus.off("viewport:change", fn);
|
|
31
|
+
bus.emit("viewport:change", {
|
|
32
|
+
transform: {
|
|
33
|
+
x: 0,
|
|
34
|
+
y: 0,
|
|
35
|
+
zoom: 1
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
(0, _vitest.expect)(fn).not.toHaveBeenCalled();
|
|
39
|
+
});
|
|
40
|
+
(0, _vitest.it)("should once call handler only once", () => {
|
|
41
|
+
const bus = (0, _eventBus.createEventBus)();
|
|
42
|
+
const fn = _vitest.vi.fn();
|
|
43
|
+
bus.once("selection:change", fn);
|
|
44
|
+
bus.emit("selection:change", {
|
|
45
|
+
selectedNodes: [],
|
|
46
|
+
selectedEdges: []
|
|
47
|
+
});
|
|
48
|
+
(0, _vitest.expect)(fn).toHaveBeenCalledTimes(1);
|
|
49
|
+
});
|
|
50
|
+
(0, _vitest.it)("should emit void event without payload", () => {
|
|
51
|
+
const bus = (0, _eventBus.createEventBus)();
|
|
52
|
+
const fn = _vitest.vi.fn();
|
|
53
|
+
bus.on("connect:cancel", fn);
|
|
54
|
+
bus.emit("connect:cancel");
|
|
55
|
+
(0, _vitest.expect)(fn).toHaveBeenCalledTimes(1);
|
|
56
|
+
});
|
|
57
|
+
(0, _vitest.it)("listenerCount", () => {
|
|
58
|
+
const bus = (0, _eventBus.createEventBus)();
|
|
59
|
+
const f1 = _vitest.vi.fn();
|
|
60
|
+
const f2 = _vitest.vi.fn();
|
|
61
|
+
bus.on("node:click", f1);
|
|
62
|
+
bus.on("node:click", f2);
|
|
63
|
+
(0, _vitest.expect)(bus.listenerCount("node:click")).toBe(2);
|
|
64
|
+
(0, _vitest.expect)(bus.listenerCount()).toBe(2);
|
|
65
|
+
});
|
|
66
|
+
(0, _vitest.it)("clear should remove all handlers", () => {
|
|
67
|
+
const bus = (0, _eventBus.createEventBus)();
|
|
68
|
+
const fn = _vitest.vi.fn();
|
|
69
|
+
bus.on("viewport:change", fn);
|
|
70
|
+
bus.clear();
|
|
71
|
+
bus.emit("viewport:change", {
|
|
72
|
+
transform: {
|
|
73
|
+
x: 0,
|
|
74
|
+
y: 0,
|
|
75
|
+
zoom: 1
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
(0, _vitest.expect)(fn).not.toHaveBeenCalled();
|
|
79
|
+
});
|
|
80
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { describe, it, expect, vi } from "vitest";
|
|
2
|
+
import { createEventBus } from "../utils/event-bus.mjs";
|
|
3
|
+
describe("flow/utils/event-bus", () => {
|
|
4
|
+
it("should subscribe and emit", () => {
|
|
5
|
+
const bus = createEventBus();
|
|
6
|
+
const fn = vi.fn();
|
|
7
|
+
bus.on("viewport:change", fn);
|
|
8
|
+
bus.emit("viewport:change", { transform: { x: 10, y: 20, zoom: 1 } });
|
|
9
|
+
expect(fn).toHaveBeenCalledTimes(1);
|
|
10
|
+
expect(fn).toHaveBeenCalledWith({ transform: { x: 10, y: 20, zoom: 1 } });
|
|
11
|
+
});
|
|
12
|
+
it("should off unsubscribe", () => {
|
|
13
|
+
const bus = createEventBus();
|
|
14
|
+
const fn = vi.fn();
|
|
15
|
+
bus.on("viewport:change", fn);
|
|
16
|
+
bus.off("viewport:change", fn);
|
|
17
|
+
bus.emit("viewport:change", { transform: { x: 0, y: 0, zoom: 1 } });
|
|
18
|
+
expect(fn).not.toHaveBeenCalled();
|
|
19
|
+
});
|
|
20
|
+
it("should once call handler only once", () => {
|
|
21
|
+
const bus = createEventBus();
|
|
22
|
+
const fn = vi.fn();
|
|
23
|
+
bus.once("selection:change", fn);
|
|
24
|
+
bus.emit("selection:change", { selectedNodes: [], selectedEdges: [] });
|
|
25
|
+
expect(fn).toHaveBeenCalledTimes(1);
|
|
26
|
+
});
|
|
27
|
+
it("should emit void event without payload", () => {
|
|
28
|
+
const bus = createEventBus();
|
|
29
|
+
const fn = vi.fn();
|
|
30
|
+
bus.on("connect:cancel", fn);
|
|
31
|
+
bus.emit("connect:cancel");
|
|
32
|
+
expect(fn).toHaveBeenCalledTimes(1);
|
|
33
|
+
});
|
|
34
|
+
it("listenerCount", () => {
|
|
35
|
+
const bus = createEventBus();
|
|
36
|
+
const f1 = vi.fn();
|
|
37
|
+
const f2 = vi.fn();
|
|
38
|
+
bus.on("node:click", f1);
|
|
39
|
+
bus.on("node:click", f2);
|
|
40
|
+
expect(bus.listenerCount("node:click")).toBe(2);
|
|
41
|
+
expect(bus.listenerCount()).toBe(2);
|
|
42
|
+
});
|
|
43
|
+
it("clear should remove all handlers", () => {
|
|
44
|
+
const bus = createEventBus();
|
|
45
|
+
const fn = vi.fn();
|
|
46
|
+
bus.on("viewport:change", fn);
|
|
47
|
+
bus.clear();
|
|
48
|
+
bus.emit("viewport:change", { transform: { x: 0, y: 0, zoom: 1 } });
|
|
49
|
+
expect(fn).not.toHaveBeenCalled();
|
|
50
|
+
});
|
|
51
|
+
});
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _vitest = require("vitest");
|
|
4
|
+
var _Flow = _interopRequireDefault(require("../Flow.vue"));
|
|
5
|
+
var _ssr = require("./utils/ssr.cjs");
|
|
6
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
7
|
+
(0, _vitest.describe)("Flow SSR", () => {
|
|
8
|
+
(0, _vitest.it)("should render Flow component in SSR", async () => {
|
|
9
|
+
const html = await (0, _ssr.renderSSR)(_Flow.default, {
|
|
10
|
+
nodes: [],
|
|
11
|
+
edges: []
|
|
12
|
+
});
|
|
13
|
+
(0, _ssr.expectSSRContains)(html, "yh-flow");
|
|
14
|
+
});
|
|
15
|
+
(0, _vitest.it)("should render with custom class in SSR", async () => {
|
|
16
|
+
const html = await (0, _ssr.renderSSR)(_Flow.default, {
|
|
17
|
+
nodes: [],
|
|
18
|
+
edges: [],
|
|
19
|
+
class: "custom-flow"
|
|
20
|
+
});
|
|
21
|
+
(0, _ssr.expectSSRHasClass)(html, "custom-flow");
|
|
22
|
+
});
|
|
23
|
+
(0, _vitest.it)("should render nodes in SSR", async () => {
|
|
24
|
+
const nodes = [{
|
|
25
|
+
id: "1",
|
|
26
|
+
type: "default",
|
|
27
|
+
position: {
|
|
28
|
+
x: 0,
|
|
29
|
+
y: 0
|
|
30
|
+
},
|
|
31
|
+
data: {
|
|
32
|
+
label: "Node 1"
|
|
33
|
+
}
|
|
34
|
+
}, {
|
|
35
|
+
id: "2",
|
|
36
|
+
type: "default",
|
|
37
|
+
position: {
|
|
38
|
+
x: 100,
|
|
39
|
+
y: 100
|
|
40
|
+
},
|
|
41
|
+
data: {
|
|
42
|
+
label: "Node 2"
|
|
43
|
+
}
|
|
44
|
+
}];
|
|
45
|
+
const html = await (0, _ssr.renderSSR)(_Flow.default, {
|
|
46
|
+
nodes,
|
|
47
|
+
edges: []
|
|
48
|
+
});
|
|
49
|
+
(0, _ssr.expectSSRContains)(html, "Node 1");
|
|
50
|
+
(0, _ssr.expectSSRContains)(html, "Node 2");
|
|
51
|
+
});
|
|
52
|
+
(0, _vitest.it)("should render edges in SSR", async () => {
|
|
53
|
+
const nodes = [{
|
|
54
|
+
id: "1",
|
|
55
|
+
type: "default",
|
|
56
|
+
position: {
|
|
57
|
+
x: 0,
|
|
58
|
+
y: 0
|
|
59
|
+
},
|
|
60
|
+
data: {
|
|
61
|
+
label: "A"
|
|
62
|
+
}
|
|
63
|
+
}, {
|
|
64
|
+
id: "2",
|
|
65
|
+
type: "default",
|
|
66
|
+
position: {
|
|
67
|
+
x: 100,
|
|
68
|
+
y: 0
|
|
69
|
+
},
|
|
70
|
+
data: {
|
|
71
|
+
label: "B"
|
|
72
|
+
}
|
|
73
|
+
}];
|
|
74
|
+
const edges = [{
|
|
75
|
+
id: "e1",
|
|
76
|
+
source: "1",
|
|
77
|
+
target: "2"
|
|
78
|
+
}];
|
|
79
|
+
const html = await (0, _ssr.renderSSR)(_Flow.default, {
|
|
80
|
+
nodes,
|
|
81
|
+
edges
|
|
82
|
+
});
|
|
83
|
+
(0, _ssr.expectSSRContains)(html, "yh-flow-edge");
|
|
84
|
+
});
|
|
85
|
+
(0, _vitest.it)("should render with fitView props in SSR", async () => {
|
|
86
|
+
const html = await (0, _ssr.renderSSR)(_Flow.default, {
|
|
87
|
+
nodes: [],
|
|
88
|
+
edges: [],
|
|
89
|
+
fitView: true
|
|
90
|
+
});
|
|
91
|
+
(0, _ssr.expectSSRContains)(html, "yh-flow");
|
|
92
|
+
});
|
|
93
|
+
(0, _vitest.it)("should render with minZoom and maxZoom in SSR", async () => {
|
|
94
|
+
const html = await (0, _ssr.renderSSR)(_Flow.default, {
|
|
95
|
+
nodes: [],
|
|
96
|
+
edges: [],
|
|
97
|
+
minZoom: 0.5,
|
|
98
|
+
maxZoom: 2
|
|
99
|
+
});
|
|
100
|
+
(0, _ssr.expectSSRContains)(html, "yh-flow");
|
|
101
|
+
});
|
|
102
|
+
(0, _vitest.it)("should render with nodesDraggable false in SSR", async () => {
|
|
103
|
+
const html = await (0, _ssr.renderSSR)(_Flow.default, {
|
|
104
|
+
nodes: [],
|
|
105
|
+
edges: [],
|
|
106
|
+
nodesDraggable: false
|
|
107
|
+
});
|
|
108
|
+
(0, _ssr.expectSSRContains)(html, "yh-flow");
|
|
109
|
+
});
|
|
110
|
+
(0, _vitest.it)("should render with edgesEditable false in SSR", async () => {
|
|
111
|
+
const html = await (0, _ssr.renderSSR)(_Flow.default, {
|
|
112
|
+
nodes: [],
|
|
113
|
+
edges: [],
|
|
114
|
+
edgesEditable: false
|
|
115
|
+
});
|
|
116
|
+
(0, _ssr.expectSSRContains)(html, "yh-flow");
|
|
117
|
+
});
|
|
118
|
+
(0, _vitest.it)("should render with snapToGrid in SSR", async () => {
|
|
119
|
+
const html = await (0, _ssr.renderSSR)(_Flow.default, {
|
|
120
|
+
nodes: [],
|
|
121
|
+
edges: [],
|
|
122
|
+
snapToGrid: true,
|
|
123
|
+
snapGrid: [20, 20]
|
|
124
|
+
});
|
|
125
|
+
(0, _ssr.expectSSRContains)(html, "yh-flow");
|
|
126
|
+
});
|
|
127
|
+
(0, _vitest.it)("should render with connection line style in SSR", async () => {
|
|
128
|
+
const html = await (0, _ssr.renderSSR)(_Flow.default, {
|
|
129
|
+
nodes: [],
|
|
130
|
+
edges: [],
|
|
131
|
+
connectionLineStyle: {
|
|
132
|
+
stroke: "#ff0000",
|
|
133
|
+
strokeWidth: 2
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
(0, _ssr.expectSSRContains)(html, "yh-flow");
|
|
137
|
+
});
|
|
138
|
+
(0, _vitest.it)("should hydrate without mismatch", async () => {
|
|
139
|
+
const nodes = [{
|
|
140
|
+
id: "1",
|
|
141
|
+
type: "default",
|
|
142
|
+
position: {
|
|
143
|
+
x: 0,
|
|
144
|
+
y: 0
|
|
145
|
+
},
|
|
146
|
+
data: {
|
|
147
|
+
label: "Test"
|
|
148
|
+
}
|
|
149
|
+
}];
|
|
150
|
+
const result = await (0, _ssr.testHydration)(_Flow.default, {
|
|
151
|
+
nodes,
|
|
152
|
+
edges: []
|
|
153
|
+
});
|
|
154
|
+
(0, _vitest.expect)(result.isMatch).toBe(true);
|
|
155
|
+
});
|
|
156
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { describe, it, expect } from "vitest";
|
|
2
|
+
import Flow from "../Flow.vue";
|
|
3
|
+
import { renderSSR, expectSSRHasClass, expectSSRContains, testHydration } from "./utils/ssr.mjs";
|
|
4
|
+
describe("Flow SSR", () => {
|
|
5
|
+
it("should render Flow component in SSR", async () => {
|
|
6
|
+
const html = await renderSSR(Flow, {
|
|
7
|
+
nodes: [],
|
|
8
|
+
edges: []
|
|
9
|
+
});
|
|
10
|
+
expectSSRContains(html, "yh-flow");
|
|
11
|
+
});
|
|
12
|
+
it("should render with custom class in SSR", async () => {
|
|
13
|
+
const html = await renderSSR(Flow, {
|
|
14
|
+
nodes: [],
|
|
15
|
+
edges: [],
|
|
16
|
+
class: "custom-flow"
|
|
17
|
+
});
|
|
18
|
+
expectSSRHasClass(html, "custom-flow");
|
|
19
|
+
});
|
|
20
|
+
it("should render nodes in SSR", async () => {
|
|
21
|
+
const nodes = [
|
|
22
|
+
{
|
|
23
|
+
id: "1",
|
|
24
|
+
type: "default",
|
|
25
|
+
position: { x: 0, y: 0 },
|
|
26
|
+
data: { label: "Node 1" }
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
id: "2",
|
|
30
|
+
type: "default",
|
|
31
|
+
position: { x: 100, y: 100 },
|
|
32
|
+
data: { label: "Node 2" }
|
|
33
|
+
}
|
|
34
|
+
];
|
|
35
|
+
const html = await renderSSR(Flow, {
|
|
36
|
+
nodes,
|
|
37
|
+
edges: []
|
|
38
|
+
});
|
|
39
|
+
expectSSRContains(html, "Node 1");
|
|
40
|
+
expectSSRContains(html, "Node 2");
|
|
41
|
+
});
|
|
42
|
+
it("should render edges in SSR", async () => {
|
|
43
|
+
const nodes = [
|
|
44
|
+
{ id: "1", type: "default", position: { x: 0, y: 0 }, data: { label: "A" } },
|
|
45
|
+
{ id: "2", type: "default", position: { x: 100, y: 0 }, data: { label: "B" } }
|
|
46
|
+
];
|
|
47
|
+
const edges = [{ id: "e1", source: "1", target: "2" }];
|
|
48
|
+
const html = await renderSSR(Flow, {
|
|
49
|
+
nodes,
|
|
50
|
+
edges
|
|
51
|
+
});
|
|
52
|
+
expectSSRContains(html, "yh-flow-edge");
|
|
53
|
+
});
|
|
54
|
+
it("should render with fitView props in SSR", async () => {
|
|
55
|
+
const html = await renderSSR(Flow, {
|
|
56
|
+
nodes: [],
|
|
57
|
+
edges: [],
|
|
58
|
+
fitView: true
|
|
59
|
+
});
|
|
60
|
+
expectSSRContains(html, "yh-flow");
|
|
61
|
+
});
|
|
62
|
+
it("should render with minZoom and maxZoom in SSR", async () => {
|
|
63
|
+
const html = await renderSSR(Flow, {
|
|
64
|
+
nodes: [],
|
|
65
|
+
edges: [],
|
|
66
|
+
minZoom: 0.5,
|
|
67
|
+
maxZoom: 2
|
|
68
|
+
});
|
|
69
|
+
expectSSRContains(html, "yh-flow");
|
|
70
|
+
});
|
|
71
|
+
it("should render with nodesDraggable false in SSR", async () => {
|
|
72
|
+
const html = await renderSSR(Flow, {
|
|
73
|
+
nodes: [],
|
|
74
|
+
edges: [],
|
|
75
|
+
nodesDraggable: false
|
|
76
|
+
});
|
|
77
|
+
expectSSRContains(html, "yh-flow");
|
|
78
|
+
});
|
|
79
|
+
it("should render with edgesEditable false in SSR", async () => {
|
|
80
|
+
const html = await renderSSR(Flow, {
|
|
81
|
+
nodes: [],
|
|
82
|
+
edges: [],
|
|
83
|
+
edgesEditable: false
|
|
84
|
+
});
|
|
85
|
+
expectSSRContains(html, "yh-flow");
|
|
86
|
+
});
|
|
87
|
+
it("should render with snapToGrid in SSR", async () => {
|
|
88
|
+
const html = await renderSSR(Flow, {
|
|
89
|
+
nodes: [],
|
|
90
|
+
edges: [],
|
|
91
|
+
snapToGrid: true,
|
|
92
|
+
snapGrid: [20, 20]
|
|
93
|
+
});
|
|
94
|
+
expectSSRContains(html, "yh-flow");
|
|
95
|
+
});
|
|
96
|
+
it("should render with connection line style in SSR", async () => {
|
|
97
|
+
const html = await renderSSR(Flow, {
|
|
98
|
+
nodes: [],
|
|
99
|
+
edges: [],
|
|
100
|
+
connectionLineStyle: { stroke: "#ff0000", strokeWidth: 2 }
|
|
101
|
+
});
|
|
102
|
+
expectSSRContains(html, "yh-flow");
|
|
103
|
+
});
|
|
104
|
+
it("should hydrate without mismatch", async () => {
|
|
105
|
+
const nodes = [{ id: "1", type: "default", position: { x: 0, y: 0 }, data: { label: "Test" } }];
|
|
106
|
+
const result = await testHydration(Flow, {
|
|
107
|
+
nodes,
|
|
108
|
+
edges: []
|
|
109
|
+
});
|
|
110
|
+
expect(result.isMatch).toBe(true);
|
|
111
|
+
});
|
|
112
|
+
});
|