-
Notifications
You must be signed in to change notification settings - Fork 518
fix: stabilize nested subgraph promoted widget resolution #9282
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
d820cff
fix: preserve combo value rendering for promoted subgraph widgets
DrJKL 42201a2
fix: stabilize nested subgraph promoted widget resolution
DrJKL 32c88d3
fix: use deep source keys for promoted widget values in vue mode
DrJKL 38419cb
fix: stabilize nested promoted widget slot resolution
DrJKL b7ef63d
fix: keep referenced subgraph definitions on unpack
DrJKL 4c0db3e
fix: remove unused exported resolution types
DrJKL 25afb54
fix: simplify promotion merge flow and widget naming
DrJKL 6ac2cfb
refactor: unify promoted widget resolution and subgraph input link tr…
DrJKL 9595fec
fix: promoted DOM widgets disabled state on subgraph exterior
DrJKL 4e2c244
[automated] Apply ESLint and Oxfmt fixes
actions-user 8690d82
fix: clear slotMetadata before repopulating in reactiveComputed
DrJKL 41907c0
fix: fall back to base widget disabled state in DomWidget override
DrJKL f1eea82
test: fix computedDisabled test to match actual setter behavior
DrJKL 1e57842
Fix: promoted test
DrJKL 9895929
fix: add nextFrame sync before drag screenshot assertion
DrJKL 835f5c8
fix: address prioritized PR9282 review items
DrJKL 356e726
fix: make subgraph input target type internal
DrJKL ce1a32d
fix: restore live promoted widget resolution behavior
DrJKL 38b088d
fix: resolve remaining Christian PR9282 comments
DrJKL 31c1ead
fix: cache promoted widget resolution per frame
DrJKL c12fc97
test: use subgraph fixtures in promoted widget resolution tests
DrJKL 2dbc101
fix: return undefined on failed promoted widget state lookup
DrJKL 62f23d0
test: use subgraph fixtures in input link resolution tests
DrJKL 4fa4642
Merge branch 'main' into drjkl/preview-fix
DrJKL 62654c6
test: use dom widget store in DomWidget test setup
DrJKL 54d117c
Merge branch 'main' into drjkl/preview-fix
DrJKL File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
760 changes: 760 additions & 0 deletions
760
browser_tests/assets/subgraphs/subgraph-nested-promotion.json
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,116 @@ | ||
| import { mount } from '@vue/test-utils' | ||
| import { createTestingPinia } from '@pinia/testing' | ||
| import { setActivePinia } from 'pinia' | ||
| import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' | ||
| import { reactive } from 'vue' | ||
|
|
||
| import { createMockLGraphNode } from '@/utils/__tests__/litegraphTestUtils' | ||
| import type { BaseDOMWidget } from '@/scripts/domWidget' | ||
| import type { DomWidgetState } from '@/stores/domWidgetStore' | ||
| import { useDomWidgetStore } from '@/stores/domWidgetStore' | ||
|
|
||
| import DomWidget from './DomWidget.vue' | ||
|
|
||
| const mockUpdatePosition = vi.fn() | ||
| const mockUpdateClipPath = vi.fn() | ||
| const mockCanvasElement = document.createElement('canvas') | ||
| const mockCanvasStore = { | ||
| canvas: { | ||
| graph: { | ||
| getNodeById: vi.fn(() => true) | ||
| }, | ||
| ds: { | ||
| offset: [0, 0], | ||
| scale: 1 | ||
| }, | ||
| canvas: mockCanvasElement, | ||
| selected_nodes: {} | ||
| }, | ||
| getCanvas: () => ({ canvas: mockCanvasElement }), | ||
| linearMode: false | ||
| } | ||
|
|
||
| vi.mock('@/composables/element/useAbsolutePosition', () => ({ | ||
| useAbsolutePosition: () => ({ | ||
| style: reactive<Record<string, string>>({}), | ||
| updatePosition: mockUpdatePosition | ||
| }) | ||
| })) | ||
|
|
||
| vi.mock('@/composables/element/useDomClipping', () => ({ | ||
| useDomClipping: () => ({ | ||
| style: reactive<Record<string, string>>({}), | ||
| updateClipPath: mockUpdateClipPath | ||
| }) | ||
| })) | ||
|
|
||
| vi.mock('@/renderer/core/canvas/canvasStore', () => ({ | ||
| useCanvasStore: () => mockCanvasStore | ||
| })) | ||
|
|
||
| vi.mock('@/platform/settings/settingStore', () => ({ | ||
| useSettingStore: () => ({ | ||
| get: vi.fn(() => false) | ||
| }) | ||
| })) | ||
|
|
||
| function createWidgetState(overrideDisabled: boolean): DomWidgetState { | ||
| const domWidgetStore = useDomWidgetStore() | ||
| const node = createMockLGraphNode({ | ||
| id: 1, | ||
| constructor: { | ||
| nodeData: {} | ||
| } | ||
| }) | ||
|
|
||
| const widget = { | ||
| id: 'dom-widget-id', | ||
| name: 'test_widget', | ||
| type: 'custom', | ||
| value: '', | ||
| options: {}, | ||
| node, | ||
| computedDisabled: false | ||
| } as unknown as BaseDOMWidget<object | string> | ||
|
|
||
| domWidgetStore.registerWidget(widget) | ||
| domWidgetStore.setPositionOverride(widget.id, { | ||
| node: createMockLGraphNode({ id: 2 }), | ||
| widget: { computedDisabled: overrideDisabled } as DomWidgetState['widget'] | ||
| }) | ||
|
|
||
| const state = domWidgetStore.widgetStates.get(widget.id) | ||
| if (!state) throw new Error('Expected registered DomWidgetState') | ||
|
|
||
| state.zIndex = 2 | ||
| state.size = [100, 40] | ||
|
|
||
| return reactive(state) | ||
| } | ||
|
|
||
| describe('DomWidget disabled style', () => { | ||
| beforeEach(() => { | ||
| setActivePinia(createTestingPinia({ stubActions: false })) | ||
| }) | ||
|
|
||
| afterEach(() => { | ||
| useDomWidgetStore().clear() | ||
| vi.clearAllMocks() | ||
| }) | ||
|
|
||
| it('uses disabled style when promoted override widget is computedDisabled', async () => { | ||
| const widgetState = createWidgetState(true) | ||
| const wrapper = mount(DomWidget, { | ||
| props: { | ||
| widgetState | ||
| } | ||
| }) | ||
|
|
||
| widgetState.zIndex = 3 | ||
| await wrapper.vm.$nextTick() | ||
|
|
||
| const root = wrapper.get('.dom-widget').element as HTMLElement | ||
| expect(root.style.pointerEvents).toBe('none') | ||
| expect(root.style.opacity).toBe('0.5') | ||
| }) | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a stabilization fix for the test, the DOM widget z-index is inconsistent at point of screenshot otherwise.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be worth coming back and adding a proper wait condition later.