From 3f72713e3ed5a1695cce9307ae13151bb78ae8bd Mon Sep 17 00:00:00 2001 From: braks <78412429+bcakmakoglu@users.noreply.github.com> Date: Wed, 8 Mar 2023 14:09:57 +0100 Subject: [PATCH] tests: test if custom props are passed to custom connection line Signed-off-by: braks <78412429+bcakmakoglu@users.noreply.github.com> --- .../2-vue-flow/customConnectionLine.cy.ts | 28 +++++++++++++------ 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/tests/cypress/component/2-vue-flow/customConnectionLine.cy.ts b/tests/cypress/component/2-vue-flow/customConnectionLine.cy.ts index 73356b5c..5838f3a1 100644 --- a/tests/cypress/component/2-vue-flow/customConnectionLine.cy.ts +++ b/tests/cypress/component/2-vue-flow/customConnectionLine.cy.ts @@ -1,11 +1,17 @@ import { h } from 'vue' import type { FunctionalComponent } from 'vue' -import type { ConnectionLineProps } from '@vue-flow/core' +import type { ConnectionLineProps, GraphNode, HandleElement } from '@vue-flow/core' import { BaseEdge, getBezierPath } from '@vue-flow/core' +let propTargetNode: GraphNode | null | undefined = null +let propTargetHandle: HandleElement | null | undefined = null + const CustomConnectionLine: FunctionalComponent = (props: ConnectionLineProps) => { const path = getBezierPath(props) + propTargetNode = props.targetNode + propTargetHandle = props.targetHandle + return h(BaseEdge, { path: path[0], class: 'test-custom-connection-line' }) } @@ -13,7 +19,6 @@ describe('Check if custom connection lines are rendered', () => { beforeEach(() => { cy.vueFlow( { - fitViewOnInit: false, modelValue: [ { id: '1', @@ -54,14 +59,19 @@ describe('Check if custom connection lines are rendered', () => { force: true, }) - cy.get('.test-custom-connection-line').should('have.length', 1) + cy.get('.test-custom-connection-line') + .should('have.length', 1) + .then(() => { + expect(propTargetNode).to.not.be.null + expect(propTargetHandle).to.not.be.null - sourceHandle.trigger('mouseup', { - clientX: x + 5, - clientY: y + 5, - force: true, - view: win, - }) + sourceHandle.trigger('mouseup', { + clientX: x + 5, + clientY: y + 5, + force: true, + view: win, + }) + }) }) }) })