Skip to content

Commit f5f5ed3

Browse files
test(litegraph): cover re-promotion when one of several interior widgets disconnects
SubgraphNode's input-disconnected listener re-resolves the promoted widget when the subgraph input still has connected widgets. Deleting that branch left every existing test green: nothing exercised a subgraph input with more than one interior widget link.
1 parent 5002fae commit f5f5ed3

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

src/lib/litegraph/src/subgraph/SubgraphWidgetPromotion.test.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,34 @@ describe('SubgraphWidgetPromotion', () => {
403403
expect(promotedInputs(subgraphNode)).toHaveLength(0)
404404
})
405405

406+
it('keeps the host widget promoted while another interior widget is still connected', () => {
407+
const subgraph = createTestSubgraph({
408+
inputs: [{ name: 'value', type: 'number' }]
409+
})
410+
411+
const { node: first } = createNodeWithWidget('First', 'number', 42)
412+
const { node: second } = createNodeWithWidget('Second', 'number', 42)
413+
subgraph.add(first)
414+
subgraph.add(second)
415+
subgraph.inputNode.slots[0].connect(first.inputs[0], first)
416+
subgraph.inputNode.slots[0].connect(second.inputs[0], second)
417+
418+
const subgraphNode = createTestSubgraphNode(subgraph)
419+
expect(promotedInputs(subgraphNode)).toHaveLength(1)
420+
expect(subgraph.inputNode.slots[0].linkIds).toHaveLength(2)
421+
422+
first.disconnectInput(0, true)
423+
424+
expect(subgraph.inputNode.slots[0].linkIds).toHaveLength(1)
425+
expect(promotedInputs(subgraphNode)).toHaveLength(1)
426+
expect(subgraphNode.widgets).toHaveLength(1)
427+
428+
second.disconnectInput(0, true)
429+
430+
expect(promotedInputs(subgraphNode)).toHaveLength(0)
431+
expect(subgraphNode.widgets).toHaveLength(0)
432+
})
433+
406434
it('writes canvas edits back to the host widget store', () => {
407435
const subgraph = createTestSubgraph({
408436
inputs: [{ name: 'value', type: 'number' }]

0 commit comments

Comments
 (0)