tests: update edges tests
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import type { StartHandle } from '@vue-flow/core'
|
||||
import type { ConnectingHandle } from '@vue-flow/core'
|
||||
import { useVueFlow } from '@vue-flow/core'
|
||||
import { getElements } from '../../../utils'
|
||||
|
||||
@@ -6,12 +6,13 @@ const { nodes, edges } = getElements(2, 2)
|
||||
|
||||
describe('Store Action: `startConnection`, `updateConnection`, `endConnection`', () => {
|
||||
const store = useVueFlow({ id: 'test' })
|
||||
const startHandle: StartHandle = { nodeId: nodes[0].id, type: 'source', handleId: null }
|
||||
const startHandle: ConnectingHandle = { nodeId: nodes[0].id, type: 'source', handleId: null }
|
||||
|
||||
beforeEach(() => {
|
||||
cy.vueFlow({
|
||||
nodes,
|
||||
edges,
|
||||
autoConnect: true,
|
||||
})
|
||||
})
|
||||
|
||||
@@ -19,9 +20,14 @@ describe('Store Action: `startConnection`, `updateConnection`, `endConnection`',
|
||||
store.startConnection(startHandle, { x: 0, y: 0 })
|
||||
|
||||
const storedStartHandle = store.connectionStartHandle.value
|
||||
expect(storedStartHandle?.handleId).to.equal(startHandle.handleId)
|
||||
expect(storedStartHandle?.nodeId).to.equal(startHandle.nodeId)
|
||||
expect(storedStartHandle?.type).to.equal(startHandle.type)
|
||||
|
||||
if (!storedStartHandle) {
|
||||
throw new Error('Start handle is not found in store')
|
||||
}
|
||||
|
||||
expect(storedStartHandle.handleId).to.equal(startHandle.handleId)
|
||||
expect(storedStartHandle.nodeId).to.equal(startHandle.nodeId)
|
||||
expect(storedStartHandle.type).to.equal(startHandle.type)
|
||||
expect(store.connectionPosition.value).to.deep.equal({ x: 0, y: 0 })
|
||||
})
|
||||
|
||||
@@ -32,7 +38,7 @@ describe('Store Action: `startConnection`, `updateConnection`, `endConnection`',
|
||||
expect(store.connectionPosition.value).to.deep.equal({ x: 100, y: 100 })
|
||||
})
|
||||
|
||||
it('shows connection line on viewpane', () => {
|
||||
it('shows connection line on view', () => {
|
||||
store.startConnection(startHandle, { x: 0, y: 0 })
|
||||
store.updateConnection({ x: 100, y: 100 })
|
||||
|
||||
@@ -46,6 +52,7 @@ describe('Store Action: `startConnection`, `updateConnection`, `endConnection`',
|
||||
|
||||
expect(store.connectionStartHandle.value).to.equal(null)
|
||||
expect(store.connectionPosition.value).to.deep.equal({ x: NaN, y: NaN })
|
||||
|
||||
cy.viewPort().find('.vue-flow__connection').should('not.exist')
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user