[backport core/1.34] fix: collapsed nodes getting extra height based on contents (#7527)

Backport of #7490 to `core/1.34`

Automatically created by backport workflow.

┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-7527-backport-core-1-34-fix-collapsed-nodes-getting-extra-height-based-on-contents-2ca6d73d3650818da7cdc7e38bfcfb28)
by [Unito](https://www.unito.io)

Co-authored-by: Rizumu Ayaka <rizumu@ayaka.moe>
This commit is contained in:
Comfy Org PR Bot
2025-12-16 09:22:42 +09:00
committed by GitHub
parent 37e8f0fe9f
commit 56fde56960
2 changed files with 47 additions and 12 deletions

View File

@@ -60,7 +60,7 @@ vi.mock('@/composables/useErrorHandling', () => ({
vi.mock('@/renderer/extensions/vueNodes/layout/useNodeLayout', () => ({
useNodeLayout: () => ({
position: { x: 100, y: 50 },
size: { width: 200, height: 100 },
size: computed(() => ({ width: 200, height: 100 })),
zIndex: 0,
startDrag: vi.fn(),
handleDrag: vi.fn(),
@@ -201,4 +201,32 @@ describe('LGraphNode', () => {
expect(wrapper.classes()).toContain('border-node-stroke-executing')
})
it('should initialize height CSS vars for collapsed nodes', () => {
const wrapper = mountLGraphNode({
nodeData: {
...mockNodeData,
flags: { collapsed: true }
}
})
expect(wrapper.element.style.getPropertyValue('--node-height')).toBe('')
expect(wrapper.element.style.getPropertyValue('--node-height-x')).toBe(
'100px'
)
})
it('should initialize height CSS vars for expanded nodes', () => {
const wrapper = mountLGraphNode({
nodeData: {
...mockNodeData,
flags: { collapsed: false }
}
})
expect(wrapper.element.style.getPropertyValue('--node-height')).toBe(
'100px'
)
expect(wrapper.element.style.getPropertyValue('--node-height-x')).toBe('')
})
})