Skip to content

Commit

Permalink
fix: make getSchemaVariables include filepicker property variables
Browse files Browse the repository at this point in the history
  • Loading branch information
vsgoulart committed Oct 28, 2024
1 parent 74bc7ae commit 739343c
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/form-js-viewer/src/util/getSchemaVariables.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ const EXPRESSION_PROPERTIES = [
'dataSource',
'columnsExpression',
'expression',
'multiple',
'accept',
];

const TEMPLATE_PROPERTIES = [
Expand Down
52 changes: 52 additions & 0 deletions packages/form-js-viewer/test/spec/filepicker.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"components": [
{
"label": "Root filepicker",
"type": "filepicker",
"id": "Field_0ix8ssu",
"key": "root_filepicker",
"accept": "=root_formats",
"multiple": "=root_multiple"
},
{
"label": "",
"components": [
{
"label": "Group filepicker",
"type": "filepicker",
"id": "Field_1afqrsw",
"key": "group_filepicker",
"accept": "=group_formats",
"multiple": "=group_multiple"
}
],
"showOutline": true,
"type": "group",
"id": "Field_1r2phwv",
"path": "group_path"
},
{
"label": "",
"components": [
{
"label": "List filepicker",
"type": "filepicker",
"id": "Field_0ngzqh9",
"key": "list_filepicker",
"accept": "=list_formats",
"multiple": "=list_multiple"
}
],
"showOutline": true,
"isRepeating": true,
"allowAddRemove": true,
"defaultRepetitions": 1,
"type": "dynamiclist",
"id": "Field_1mfpipo",
"path": "dynamiclist_path"
}
],
"type": "default",
"id": "filepicker_form",
"schemaVersion": 17
}
17 changes: 17 additions & 0 deletions packages/form-js-viewer/test/spec/util/GetSchemaVariables.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import shipsExampleSchema from '../ships-example.json';
import iframesSchema from '../iframes.json';
import htmlSchema from '../html.json';
import expressionFieldSchema from '../expressionField.json';
import filepickerSchema from '../filepicker.json';

describe('util/getSchemaVariables', () => {
it('should include form field keys', () => {
Expand Down Expand Up @@ -211,4 +212,20 @@ describe('util/getSchemaVariables', () => {

expect(variables).to.include.members(['exp_expression', 'data', 'selected', 'filter']);
});

it('should include variables in filepickers', () => {
const variables = getSchemaVariables(filepickerSchema);

expect(variables).to.eql([
'root_multiple',
'root_formats',
'group_multiple',
'group_formats',
'list_multiple',
'list_formats',
'root_filepicker',
'group_path',
'dynamiclist_path',
]);
});
});

0 comments on commit 739343c

Please sign in to comment.