fix: Fix mapping paths when appending to empty expression (#5591)

* fix: Fix mapping when appending to empty expression

* fix: refactor logic out

* test: add tests

* test: add tests

* fix: fix bug where value does not get updated when mapping

* test: add test for bug

* test: add test for bug
This commit is contained in:
Mutasem Aldmour
2023-03-02 15:02:29 +03:00
committed by GitHub
parent 31cc8de829
commit 1f7b478920
9 changed files with 294 additions and 33 deletions

View File

@@ -262,4 +262,34 @@ describe('Data mapping', () => {
.find('input')
.should('have.value', 'input[0]["hello.world"]["my count"]');
});
it('maps expressions to updated fields correctly', () => {
cy.fixture('Test_workflow_3.json').then((data) => {
cy.get('body').paste(JSON.stringify(data));
});
workflowPage.actions.openNode('Set');
ndv.actions.typeIntoParameterInput('value', 'delete me');
ndv.actions.dismissMappingTooltip();
ndv.actions.typeIntoParameterInput('name', 'test');
ndv.actions.typeIntoParameterInput('value', 'fun');
ndv.actions.clearParameterInput('value'); // keep focus on param
ndv.getters.inputDataContainer().should('exist').find('span').contains('count').realMouseDown();
ndv.actions.mapToParameter('value');
ndv.getters.inlineExpressionEditorInput().should('have.text', '{{ $json.input[0].count }}');
ndv.getters.parameterExpressionPreview('value').should('include.text', '0');
ndv.getters.inputDataContainer().find('span').contains('input').realMouseDown();
ndv.actions.mapToParameter('value');
ndv.getters
.inlineExpressionEditorInput()
.should('have.text', '{{ $json.input[0].count }} {{ $json.input }}');
ndv.getters.parameterExpressionPreview('value').should('include.text', '0 [object Object]');
});
});