fix(editor): Fix expression preview when previous node is selected (#9140)

This commit is contained in:
Elias Meire 2024-04-19 10:07:00 +02:00 committed by GitHub
parent a3eea3ac5e
commit 85780eade5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 39 additions and 6 deletions

View file

@ -276,6 +276,33 @@ describe('Data mapping', () => {
ndv.actions.validateExpressionPreview('value', '0 [object Object]');
});
it('renders expression preview when a previous node is selected', () => {
cy.fixture('Test_workflow_3.json').then((data) => {
cy.get('body').paste(JSON.stringify(data));
});
workflowPage.actions.openNode('Set');
ndv.actions.typeIntoParameterInput('value', 'test_value');
ndv.actions.typeIntoParameterInput('name', '{selectall}test_name');
ndv.actions.close();
workflowPage.actions.openNode('Set1');
ndv.actions.executePrevious();
ndv.getters.executingLoader().should('not.exist');
ndv.getters.inputDataContainer().should('exist');
ndv.getters
.inputDataContainer()
.should('exist')
.find('span')
.contains('test_name')
.realMouseDown();
ndv.actions.mapToParameter('value');
ndv.actions.validateExpressionPreview('value', 'test_value');
ndv.actions.selectInputNode(SCHEDULE_TRIGGER_NODE_NAME);
ndv.actions.validateExpressionPreview('value', 'test_value');
});
it('shows you can drop to inputs, including booleans', () => {
cy.fixture('Test_workflow_3.json').then((data) => {
cy.get('body').paste(JSON.stringify(data));

View file

@ -83,12 +83,18 @@ const hint = computed(() => {
let result: Result<unknown, Error>;
try {
const resolvedValue = resolveExpression(value, undefined, {
targetItem: ndvStore.hoveringItem ?? undefined,
inputNodeName: ndvStore.ndvInputNodeName,
inputRunIndex: ndvStore.ndvInputRunIndex,
inputBranchIndex: ndvStore.ndvInputBranchIndex,
}) as unknown;
const resolvedValue = resolveExpression(
value,
undefined,
ndvStore.isInputParentOfActiveNode
? {
targetItem: ndvStore.hoveringItem ?? undefined,
inputNodeName: ndvStore.ndvInputNodeName,
inputRunIndex: ndvStore.ndvInputRunIndex,
inputBranchIndex: ndvStore.ndvInputBranchIndex,
}
: {},
) as unknown;
result = { ok: true, result: resolvedValue };
} catch (error) {