diff --git a/packages/form-js-viewer/src/util/getSchemaVariables.js b/packages/form-js-viewer/src/util/getSchemaVariables.js index a6f629213..d5615ce85 100644 --- a/packages/form-js-viewer/src/util/getSchemaVariables.js +++ b/packages/form-js-viewer/src/util/getSchemaVariables.js @@ -22,6 +22,7 @@ const EXPRESSION_PROPERTIES = [ 'url', 'dataSource', 'columnsExpression', + 'expression', ]; const TEMPLATE_PROPERTIES = [ diff --git a/packages/form-js-viewer/test/spec/expressionField.json b/packages/form-js-viewer/test/spec/expressionField.json new file mode 100644 index 000000000..ef29ac2fc --- /dev/null +++ b/packages/form-js-viewer/test/spec/expressionField.json @@ -0,0 +1,18 @@ +{ + "id": "Form_1lywnv3", + "components": [ + { + "computeOn": "change", + "label": "Expression", + "type": "expression", + "layout": { + "row": "Row_0duk8pr", + "columns": null + }, + "id": "Field_01dikzb", + "key": "exp_expression", + "expression": "=flatten(data[selected = filter].dates)" + } + ], + "type": "default" +} diff --git a/packages/form-js-viewer/test/spec/util/GetSchemaVariables.spec.js b/packages/form-js-viewer/test/spec/util/GetSchemaVariables.spec.js index abf50b2df..590d90a38 100644 --- a/packages/form-js-viewer/test/spec/util/GetSchemaVariables.spec.js +++ b/packages/form-js-viewer/test/spec/util/GetSchemaVariables.spec.js @@ -18,6 +18,7 @@ import groupsSchema from '../groups.json'; import shipsExampleSchema from '../ships-example.json'; import iframesSchema from '../iframes.json'; import htmlSchema from '../html.json'; +import expressionFieldSchema from '../expressionField.json'; describe('util/getSchemaVariables', () => { it('should include form field keys', () => { @@ -204,4 +205,10 @@ describe('util/getSchemaVariables', () => { 'separated2', ]); }); + + it('should include variables in complex templates', () => { + const variables = getSchemaVariables(expressionFieldSchema); + + expect(variables).to.include.members(['exp_expression', 'data', 'selected', 'filter']); + }); });