Fix render issues after moving floating input links (#841)

- Fixes floating inputs have invisible segment after moving
- Fixes floating input can be moved onto existing input link, resulting
in the slot having two links
This commit is contained in:
filtered
2025-03-24 11:16:06 +11:00
committed by GitHub
parent 7b8f01f546
commit fd4ffbc1f8
3 changed files with 28 additions and 4 deletions

View File

@@ -530,6 +530,27 @@ describe("LinkConnector Integration", () => {
validateIntegrityFloatingRemoved()
})
test("Dropping a floating input link onto input slot disconnects the existing link", ({ graph, connector }) => {
const manyOutputsNode = graph.getNodeById(4)!
manyOutputsNode.disconnectOutput(0)
const floatingInputNode = graph.getNodeById(6)!
const fromFloatingInput = floatingInputNode.inputs[0]
const hasInputNode = graph.getNodeById(2)!
const toInput = hasInputNode.inputs[0]
connector.moveInputLink(graph, fromFloatingInput)
const dropEvent = mockedInputDropEvent(hasInputNode, 0)
connector.dropLinks(graph, dropEvent)
expect(fromFloatingInput.link).toBeNull()
expect(fromFloatingInput._floatingLinks?.size).toBe(0)
expect(toInput.link).toBeNull()
expect(toInput._floatingLinks?.size).toBe(1)
})
})
test("Should drop floating links when both sides are disconnected", ({ graph, connector, reroutesBeforeTest, validateIntegrityNoChanges }) => {