refactor(tests): rename e2e to tests
Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
import type { Edge, Node } from '@vue-flow/core'
|
||||
|
||||
export function getElements(xElements = 10, yElements = 10) {
|
||||
const initialNodes: Node[] = []
|
||||
const initialEdges: Edge[] = []
|
||||
let nodeId = 1
|
||||
let recentNodeId = null
|
||||
|
||||
for (let y = 0; y < yElements; y++) {
|
||||
for (let x = 0; x < xElements; x++) {
|
||||
initialNodes.push({
|
||||
id: nodeId.toString(),
|
||||
label: `Node ${nodeId}`,
|
||||
style: (node) => {
|
||||
const style: Record<string, any> = { width: `50px`, fontSize: `11px`, zIndex: 1 }
|
||||
if (node.selected) style.border = '1px solid red'
|
||||
return style
|
||||
},
|
||||
type: 'default',
|
||||
position: { x: x * 100, y: y * 50 },
|
||||
data: {
|
||||
randomData: Math.floor(Math.random() * 1e3),
|
||||
},
|
||||
})
|
||||
|
||||
if (recentNodeId && nodeId <= xElements * yElements) {
|
||||
initialEdges.push({
|
||||
id: `${x}-${y}`,
|
||||
source: recentNodeId.toString(),
|
||||
target: nodeId.toString(),
|
||||
data: {
|
||||
randomData: Math.floor(Math.random() * 1e3),
|
||||
},
|
||||
style: (edge) => {
|
||||
if (edge.selected) return { stroke: '#10b981', strokeWidth: 3 }
|
||||
},
|
||||
animated: Math.random() > 0.5,
|
||||
})
|
||||
}
|
||||
|
||||
recentNodeId = nodeId
|
||||
nodeId++
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
nodes: initialNodes,
|
||||
edges: initialEdges,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export * from './elements'
|
||||
Reference in New Issue
Block a user