chore(tests) added README and added plugins to generic tests

This commit is contained in:
Peter
2023-11-13 11:36:59 +01:00
parent d4df8be6f2
commit 6db6d957d3
5 changed files with 120 additions and 6 deletions
+5 -1
View File
@@ -1,7 +1,11 @@
import { Edge, Node, ReactFlowProps } from '@xyflow/react';
import { BackgroundProps, ControlProps, Edge, MiniMapProps, Node, PanelProps, ReactFlowProps } from '@xyflow/react';
declare global {
interface FlowConfig {
flowProps: Omit<ReactFlowProps, 'nodes' | 'edges'> & { nodes: Node[]; edges: Edge[] };
panelProps: PanelProps;
backgroundProps: BackgroundProps;
controlsProps: ControlProps;
minimapProps: MiniMapProps;
}
}
+10 -1
View File
@@ -7,6 +7,10 @@ import {
OnNodesChange,
OnEdgesChange,
OnConnect,
Controls,
Panel,
MiniMap,
Background,
} from '@xyflow/react';
type FlowProps = {
@@ -24,7 +28,12 @@ export default ({ flowConfig }: FlowProps) => {
return (
<div style={{ height: '100%' }}>
<ReactFlow {...props} onNodesChange={onNodesChange} onEdgesChange={onEdgesChange} onConnect={onConnect} />
<ReactFlow {...props} onNodesChange={onNodesChange} onEdgesChange={onEdgesChange} onConnect={onConnect}>
{flowConfig.controlsProps && <Controls {...flowConfig.controlsProps} />}
{flowConfig.panelProps && <Panel {...flowConfig.panelProps} />}
{flowConfig.minimapProps && <MiniMap {...flowConfig.minimapProps} />}
{flowConfig.backgroundProps && <Background {...flowConfig.backgroundProps} />}
</ReactFlow>
</div>
);
};