fix(editor): Fix '=' handling in expressions (#13129)

This commit is contained in:
Elias Meire
2025-02-10 16:41:55 +01:00
committed by GitHub
parent f057cfb46a
commit 8f25a06e6c
15 changed files with 200 additions and 207 deletions

View File

@@ -1,3 +1,4 @@
import { EDIT_FIELDS_SET_NODE_NAME } from '../constants';
import { NDV } from '../pages/ndv';
import { WorkflowPage as WorkflowPageClass } from '../pages/workflow';
@@ -24,6 +25,25 @@ describe('Inline expression editor', () => {
ndv.getters.outputPanel().click();
WorkflowPage.getters.inlineExpressionEditorOutput().should('not.exist');
});
it('should switch between expression and fixed using keyboard', () => {
WorkflowPage.actions.addNodeToCanvas(EDIT_FIELDS_SET_NODE_NAME);
WorkflowPage.actions.openNode(EDIT_FIELDS_SET_NODE_NAME);
// Should switch to expression with =
ndv.getters.assignmentCollectionAdd('assignments').click();
ndv.actions.typeIntoParameterInput('value', '=');
// Should complete {{ --> {{ | }}
WorkflowPage.getters.inlineExpressionEditorInput().click().type('{{');
WorkflowPage.getters.inlineExpressionEditorInput().should('have.text', '{{ }}');
// Should switch back to fixed with backspace on empty expression
ndv.actions.typeIntoParameterInput('value', '{selectall}{backspace}');
ndv.getters.parameterInput('value').click();
ndv.actions.typeIntoParameterInput('value', '{backspace}');
ndv.getters.inlineExpressionEditorInput().should('not.exist');
});
});
describe('Static data', () => {

View File

@@ -49,7 +49,8 @@ describe('Editors', () => {
ndv.getters
.sqlEditorContainer()
.find('.cm-content')
.type('SELECT * FROM {{ $json.table }}', { parseSpecialCharSequences: false });
// }} is inserted automatically by bracket matching
.type('SELECT * FROM {{ $json.table', { parseSpecialCharSequences: false });
workflowPage.getters
.inlineExpressionEditorOutput()
.should('have.text', 'SELECT * FROM test_table');

View File

@@ -204,7 +204,7 @@ export class NDV extends BasePage {
typeIntoParameterInput: (
parameterName: string,
content: string,
opts?: { parseSpecialCharSequences: boolean },
opts?: Partial<Cypress.TypeOptions>,
) => {
this.getters.parameterInput(parameterName).type(content, opts);
},