diff --git a/src/cloud-element-templates/properties/CustomProperties.js b/src/cloud-element-templates/properties/CustomProperties.js index b26c867..43fd0fd 100644 --- a/src/cloud-element-templates/properties/CustomProperties.js +++ b/src/cloud-element-templates/properties/CustomProperties.js @@ -73,6 +73,7 @@ export function CustomProperties(props) { element, id: `ElementTemplates__CustomProperties-${groupId}`, label: group.label, + openByDefault: group.openByDefault, properties: properties, templateId: `${id}-${groupId}`, tooltip: PropertyTooltip({ tooltip: group.tooltip }) @@ -98,17 +99,20 @@ function addCustomGroup(groups, props) { element, id, label, + openByDefault, properties, templateId, tooltip } = props; + const shouldOpen = typeof openByDefault === 'undefined' ? true : openByDefault; + const customPropertiesGroup = { id, label, component: Group, entries: [], - shouldOpen: true, + shouldOpen, tooltip }; diff --git a/test/spec/cloud-element-templates/properties/CustomProperties.groups.bpmn b/test/spec/cloud-element-templates/properties/CustomProperties.groups.bpmn index 9185d7a..1e379b5 100644 --- a/test/spec/cloud-element-templates/properties/CustomProperties.groups.bpmn +++ b/test/spec/cloud-element-templates/properties/CustomProperties.groups.bpmn @@ -1,5 +1,5 @@ - + @@ -18,6 +18,19 @@ + + + + + + + + + + + + + @@ -36,6 +49,10 @@ + + + + diff --git a/test/spec/cloud-element-templates/properties/CustomProperties.groups.json b/test/spec/cloud-element-templates/properties/CustomProperties.groups.json index ea3452c..a97b3d8 100644 --- a/test/spec/cloud-element-templates/properties/CustomProperties.groups.json +++ b/test/spec/cloud-element-templates/properties/CustomProperties.groups.json @@ -75,6 +75,68 @@ } ] }, + { + "$schema": "https://unpkg.com/@camunda/zeebe-element-templates-json-schema/resources/schema.json", + "name": "Grouping - Collapsed", + "id": "example.com.grouping.collapsed", + "appliesTo": [ + "bpmn:ServiceTask" + ], + "properties": [ + { + "type": "String", + "value": "http", + "binding": { + "type": "zeebe:taskDefinition:type" + } + }, + { + "label": "REST Endpoint URL", + "group": "collapsed", + "type": "String", + "binding": { + "type": "zeebe:taskHeader", + "key": "url" + } + }, + { + "label": "Request Body", + "value": "", + "group": "open", + "type": "String", + "binding": { + "type": "zeebe:input", + "name": "body" + } + }, + { + "label": "Result Variable", + "group": "unspecified", + "value": "response", + "type": "String", + "binding": { + "type": "zeebe:output", + "source": "= body" + } + } + ], + "groups": [ + { + "id": "collapsed", + "label": "Collapsed Group", + "openByDefault": false + }, + { + "id": "open", + "label": "Opened Group", + "openByDefault": true + }, + { + "id": "unspecified", + "label": "Open State Undefined" + } + ] + }, { "$schema": "https://unpkg.com/@camunda/zeebe-element-templates-json-schema/resources/schema.json", "name": "no default", diff --git a/test/spec/cloud-element-templates/properties/CustomProperties.spec.js b/test/spec/cloud-element-templates/properties/CustomProperties.spec.js index 93730cf..ee3c080 100644 --- a/test/spec/cloud-element-templates/properties/CustomProperties.spec.js +++ b/test/spec/cloud-element-templates/properties/CustomProperties.spec.js @@ -1795,22 +1795,22 @@ describe('provider/cloud-element-templates - CustomProperties', function() { }); - it('should open custom groups', async function() { + it('should open custom groups by default', async function() { // given - await expectSelected('ServiceTask_1'); + await expectSelected('ServiceTask_groupsCollapsed'); // when var customGroups = [ - getGroupById('ElementTemplates__CustomProperties-headers', container), - getGroupById('ElementTemplates__CustomProperties-payload', container), - getGroupById('ElementTemplates__CustomProperties-mapping', container), - getGroupById('ElementTemplates__CustomProperties', container) + [ getGroupById('ElementTemplates__CustomProperties-collapsed', container), false ], + [ getGroupById('ElementTemplates__CustomProperties-open', container), true ], + [ getGroupById('ElementTemplates__CustomProperties-unspecified', container), true ], + [ getGroupById('ElementTemplates__CustomProperties', container),true ] ]; // then - customGroups.forEach(function(group) { - expectGroupOpen(group, true); + customGroups.forEach(function([ group, open ]) { + expectGroupOpen(group, open); }); });