Skip to content

Commit

Permalink
fix(editor): Fix expression preview when previous node is selected (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
elsmr authored Apr 19, 2024
1 parent a3eea3a commit 85780ea
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 6 deletions.
27 changes: 27 additions & 0 deletions cypress/e2e/14-mapping.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 85780ea

Please sign in to comment.