diff --git a/src/cloud-element-templates/CalledElementBehavior.js b/src/cloud-element-templates/behavior/CalledElementBehavior.js similarity index 92% rename from src/cloud-element-templates/CalledElementBehavior.js rename to src/cloud-element-templates/behavior/CalledElementBehavior.js index 8d826a66..603b2476 100644 --- a/src/cloud-element-templates/CalledElementBehavior.js +++ b/src/cloud-element-templates/behavior/CalledElementBehavior.js @@ -1,7 +1,7 @@ import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor'; import { is } from 'bpmn-js/lib/util/ModelUtil'; -import { findExtension } from './Helper'; +import { findExtension } from '../Helper'; /** * Enforces no variable propagation for templated call activities. @@ -11,7 +11,7 @@ export class CalledElementBehavior extends CommandInterceptor { /** * @param {*} eventBus * @param {*} modeling - * @param {import('./ElementTemplates').default} elementTemplates + * @param {import('../ElementTemplates').default} elementTemplates */ constructor(eventBus, modeling, elementTemplates) { super(eventBus); diff --git a/src/cloud-element-templates/ElementTemplatesConditionChecker.js b/src/cloud-element-templates/behavior/ConditionalBehavior.js similarity index 96% rename from src/cloud-element-templates/ElementTemplatesConditionChecker.js rename to src/cloud-element-templates/behavior/ConditionalBehavior.js index e0fa22dc..52b194af 100644 --- a/src/cloud-element-templates/ElementTemplatesConditionChecker.js +++ b/src/cloud-element-templates/behavior/ConditionalBehavior.js @@ -1,11 +1,11 @@ import { applyConditions -} from './Condition'; +} from '../Condition'; import { isObject } from 'min-dash'; import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor'; -import { ZEEBE_TASK_DEFINITION, ZEEBE_TASK_DEFINITION_TYPE_TYPE } from './util/bindingTypes'; +import { ZEEBE_TASK_DEFINITION, ZEEBE_TASK_DEFINITION_TYPE_TYPE } from '../util/bindingTypes'; const HIGH_PRIORITY = 2500; @@ -13,7 +13,7 @@ const HIGH_PRIORITY = 2500; * Checks the conditions of an element template and sets/resets the * corresponding properties on the element. */ -export default class ElementTemplatesConditionChecker extends CommandInterceptor { +export default class ConditionalBehavior extends CommandInterceptor { constructor(eventBus, elementTemplates, commandStack, bpmnFactory, injector) { super(eventBus); @@ -105,7 +105,7 @@ export default class ElementTemplatesConditionChecker extends CommandInterceptor } -ElementTemplatesConditionChecker.$inject = [ +ConditionalBehavior.$inject = [ 'eventBus', 'elementTemplates', 'commandStack', diff --git a/src/cloud-element-templates/GeneratedValueBehavior.js b/src/cloud-element-templates/behavior/GeneratedValueBehavior.js similarity index 89% rename from src/cloud-element-templates/GeneratedValueBehavior.js rename to src/cloud-element-templates/behavior/GeneratedValueBehavior.js index 18def5c1..2a783547 100644 --- a/src/cloud-element-templates/GeneratedValueBehavior.js +++ b/src/cloud-element-templates/behavior/GeneratedValueBehavior.js @@ -1,7 +1,7 @@ import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor'; -import { getDefaultValue } from './Helper'; -import { getPropertyValue, setPropertyValue } from './util/propertyUtil'; +import { getDefaultValue } from '../Helper'; +import { getPropertyValue, setPropertyValue } from '../util/propertyUtil'; /** * Handles generated value properties. diff --git a/src/cloud-element-templates/ReferencedElementBehavior.js b/src/cloud-element-templates/behavior/ReferencedElementBehavior.js similarity index 97% rename from src/cloud-element-templates/ReferencedElementBehavior.js rename to src/cloud-element-templates/behavior/ReferencedElementBehavior.js index ec1a9c40..f06e73c3 100644 --- a/src/cloud-element-templates/ReferencedElementBehavior.js +++ b/src/cloud-element-templates/behavior/ReferencedElementBehavior.js @@ -2,11 +2,11 @@ import { getBusinessObject, isAny } from 'bpmn-js/lib/util/ModelUtil'; import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor'; import { isString } from 'min-dash'; -import { findMessage, getTemplateId, TEMPLATE_ID_ATTR } from './Helper'; +import { findMessage, getTemplateId, TEMPLATE_ID_ATTR } from '../Helper'; import { getReferringElement, removeRootElement -} from './util/rootElementUtil'; +} from '../util/rootElementUtil'; /** * Handles referenced elements. diff --git a/src/cloud-element-templates/ReplaceBehavior.js b/src/cloud-element-templates/behavior/ReplaceBehavior.js similarity index 100% rename from src/cloud-element-templates/ReplaceBehavior.js rename to src/cloud-element-templates/behavior/ReplaceBehavior.js diff --git a/src/cloud-element-templates/UpdateTemplatePropertiesOrder.js b/src/cloud-element-templates/behavior/UpdatePropertiesOrderBehavior.js similarity index 98% rename from src/cloud-element-templates/UpdateTemplatePropertiesOrder.js rename to src/cloud-element-templates/behavior/UpdatePropertiesOrderBehavior.js index 61b8bd59..92763de5 100644 --- a/src/cloud-element-templates/UpdateTemplatePropertiesOrder.js +++ b/src/cloud-element-templates/behavior/UpdatePropertiesOrderBehavior.js @@ -1,8 +1,8 @@ import CommandInterceptor from 'diagram-js/lib/command/CommandInterceptor'; import { isObject } from 'min-dash'; -import { applyConditions } from './Condition'; -import { findExtension } from './Helper'; +import { applyConditions } from '../Condition'; +import { findExtension } from '../Helper'; /** * Restores the original order of the template properties diff --git a/src/cloud-element-templates/behavior/index.js b/src/cloud-element-templates/behavior/index.js new file mode 100644 index 00000000..9200af55 --- /dev/null +++ b/src/cloud-element-templates/behavior/index.js @@ -0,0 +1,23 @@ +import ConditionalBehavior from './ConditionalBehavior'; +import ReplaceBehavior from './ReplaceBehavior'; +import UpdatePropertiesOrderBehavior from './UpdatePropertiesOrderBehavior'; +import { ReferencedElementBehavior } from './ReferencedElementBehavior'; +import { GeneratedValueBehavior } from './GeneratedValueBehavior'; +import { CalledElementBehavior } from './CalledElementBehavior'; + +export default { + __init__: [ + 'elementTemplatesReplaceBehavior', + 'elementTemplatesConditionalBehavior', + 'elementTemplatesGeneratedValueBehavior', + 'elementTemplatesReferencedElementBehavior', + 'elementTemplatesUpdatePropertiesOrderBehavior', + 'elementTemplatesCalledElementBehavior' + ], + elementTemplatesReplaceBehavior: [ 'type', ReplaceBehavior ], + elementTemplatesConditionalBehavior: [ 'type', ConditionalBehavior ], + elementTemplatesGeneratedValueBehavior: [ 'type', GeneratedValueBehavior ], + elementTemplatesReferencedElementBehavior: [ 'type', ReferencedElementBehavior ], + elementTemplatesUpdatePropertiesOrderBehavior: [ 'type', UpdatePropertiesOrderBehavior ], + elementTemplatesCalledElementBehavior: [ 'type', CalledElementBehavior ] +}; diff --git a/src/cloud-element-templates/core/index.js b/src/cloud-element-templates/core/index.js new file mode 100644 index 00000000..5e9f8e19 --- /dev/null +++ b/src/cloud-element-templates/core/index.js @@ -0,0 +1,19 @@ +import ElementTemplates from '../ElementTemplates'; +import ElementTemplatesLoader from '../ElementTemplatesLoader'; + +import commandsModule from '../cmd'; +import createModule from '../create'; +import behaviorModule from '../behavior'; + +export default { + __depends__: [ + commandsModule, + behaviorModule, + createModule + ], + __init__: [ + 'elementTemplatesLoader' + ], + elementTemplates: [ 'type', ElementTemplates ], + elementTemplatesLoader: [ 'type', ElementTemplatesLoader ] +}; diff --git a/src/cloud-element-templates/index.js b/src/cloud-element-templates/index.js index 14fcc678..c92ff54e 100644 --- a/src/cloud-element-templates/index.js +++ b/src/cloud-element-templates/index.js @@ -1,41 +1,9 @@ -import translateModule from 'diagram-js/lib/i18n/translate'; - -import ElementTemplatesConditionChecker from './ElementTemplatesConditionChecker'; -import ElementTemplates from './ElementTemplates'; -import ElementTemplatesLoader from './ElementTemplatesLoader'; -import ReplaceBehavior from './ReplaceBehavior'; -import commandsModule from './cmd'; -import templateElementFactoryModule from './create'; -import ElementTemplatesPropertiesProvider from './ElementTemplatesPropertiesProvider'; -import UpdateTemplatePropertiesOrder from './UpdateTemplatePropertiesOrder'; -import { ReferencedElementBehavior } from './ReferencedElementBehavior'; -import { GeneratedValueBehavior } from './GeneratedValueBehavior'; -import { CalledElementBehavior } from './CalledElementBehavior'; - +import coreModule from './core'; +import propertiesProviderModule from './properties-panel'; export default { __depends__: [ - commandsModule, - templateElementFactoryModule, - translateModule - ], - __init__: [ - 'elementTemplatesLoader', - 'replaceBehavior', - 'elementTemplatesPropertiesProvider', - 'elementTemplatesConditionChecker', - 'generatedValueBehavior', - 'referencedElementBehavior', - 'updateTemplatePropertiesOrder', - 'calledElementBehavior' - ], - elementTemplates: [ 'type', ElementTemplates ], - elementTemplatesLoader: [ 'type', ElementTemplatesLoader ], - replaceBehavior: [ 'type', ReplaceBehavior ], - elementTemplatesPropertiesProvider: [ 'type', ElementTemplatesPropertiesProvider ], - elementTemplatesConditionChecker: [ 'type', ElementTemplatesConditionChecker ], - generatedValueBehavior: [ 'type', GeneratedValueBehavior ], - referencedElementBehavior: [ 'type', ReferencedElementBehavior ], - updateTemplatePropertiesOrder: [ 'type', UpdateTemplatePropertiesOrder ], - calledElementBehavior: [ 'type', CalledElementBehavior ] + coreModule, + propertiesProviderModule, + ] }; diff --git a/src/cloud-element-templates/LinterPlugin.js b/src/cloud-element-templates/linting/LinterPlugin.js similarity index 92% rename from src/cloud-element-templates/LinterPlugin.js rename to src/cloud-element-templates/linting/LinterPlugin.js index 08458064..827eef08 100644 --- a/src/cloud-element-templates/LinterPlugin.js +++ b/src/cloud-element-templates/linting/LinterPlugin.js @@ -9,17 +9,17 @@ */ import StaticResolver from 'bpmnlint/lib/resolver/static-resolver'; -import ElementTemplates from './ElementTemplates'; -import { getPropertyValue, validateProperty } from './util/propertyUtil'; +import ElementTemplates from '../ElementTemplates'; +import { getPropertyValue, validateProperty } from '../util/propertyUtil'; -import { applyConditions } from './Condition'; +import { applyConditions } from '../Condition'; import BpmnModdle from 'bpmn-moddle'; import { is } from 'bpmn-js/lib/util/ModelUtil'; import zeebeModdle from 'zeebe-bpmn-moddle/resources/zeebe'; -import { Validator } from './Validator'; +import { Validator } from '../Validator'; export const elementTemplateLintRule = ({ templates = [] }) => { const moddle = new BpmnModdle({ zeebe: zeebeModdle }); diff --git a/src/cloud-element-templates/linting/index.js b/src/cloud-element-templates/linting/index.js new file mode 100644 index 00000000..0f11481b --- /dev/null +++ b/src/cloud-element-templates/linting/index.js @@ -0,0 +1 @@ +export * from './LinterPlugin'; \ No newline at end of file diff --git a/src/cloud-element-templates/ElementTemplatesPropertiesProvider.js b/src/cloud-element-templates/properties-panel/ElementTemplatesPropertiesProvider.js similarity index 94% rename from src/cloud-element-templates/ElementTemplatesPropertiesProvider.js rename to src/cloud-element-templates/properties-panel/ElementTemplatesPropertiesProvider.js index ab4a83ec..8df133c7 100644 --- a/src/cloud-element-templates/ElementTemplatesPropertiesProvider.js +++ b/src/cloud-element-templates/properties-panel/ElementTemplatesPropertiesProvider.js @@ -1,17 +1,17 @@ import { createElementTemplatesGroup, TemplateProps -} from '../element-templates/components'; +} from '../../element-templates/components'; import { CustomProperties, MessageProps } from './properties'; -import { getTemplateId } from './Helper'; +import { getTemplateId } from '../Helper'; -import { applyConditions } from './Condition'; -import { getPropertyValue } from './util/propertyUtil'; +import { applyConditions } from '../Condition'; +import { getPropertyValue } from '../util/propertyUtil'; const LOWER_PRIORITY = 300; diff --git a/src/cloud-element-templates/components/PropertyTooltip.js b/src/cloud-element-templates/properties-panel/components/PropertyTooltip.js similarity index 75% rename from src/cloud-element-templates/components/PropertyTooltip.js rename to src/cloud-element-templates/properties-panel/components/PropertyTooltip.js index 8e890bbc..7d8cdabd 100644 --- a/src/cloud-element-templates/components/PropertyTooltip.js +++ b/src/cloud-element-templates/properties-panel/components/PropertyTooltip.js @@ -1,6 +1,6 @@ import Markup from 'preact-markup'; -import { sanitizeHTML } from '../../element-templates/util/sanitize'; +import { sanitizeHTML } from '../../../element-templates/util/sanitize'; export function PropertyTooltip(props) { diff --git a/src/cloud-element-templates/properties-panel/index.js b/src/cloud-element-templates/properties-panel/index.js new file mode 100644 index 00000000..579099f6 --- /dev/null +++ b/src/cloud-element-templates/properties-panel/index.js @@ -0,0 +1,13 @@ +import translateModule from 'diagram-js/lib/i18n/translate'; + +import ElementTemplatesPropertiesProvider from './ElementTemplatesPropertiesProvider'; + +export default { + __depends__: [ + translateModule + ], + __init__: [ + 'elementTemplatesPropertiesProvider' + ], + elementTemplatesPropertiesProvider: [ 'type', ElementTemplatesPropertiesProvider ] +}; diff --git a/src/cloud-element-templates/properties/CustomProperties.js b/src/cloud-element-templates/properties-panel/properties/CustomProperties.js similarity index 97% rename from src/cloud-element-templates/properties/CustomProperties.js rename to src/cloud-element-templates/properties-panel/properties/CustomProperties.js index 12907eb6..9672d947 100644 --- a/src/cloud-element-templates/properties/CustomProperties.js +++ b/src/cloud-element-templates/properties-panel/properties/CustomProperties.js @@ -6,10 +6,10 @@ import { import { useService } from 'bpmn-js-properties-panel'; -import { PropertyDescription } from '../../element-templates/components/PropertyDescription'; +import { PropertyDescription } from '../../../element-templates/components/PropertyDescription'; import { PropertyTooltip } from '../components/PropertyTooltip'; -import { getPropertyValue, setPropertyValue, validateProperty } from '../util/propertyUtil'; +import { getPropertyValue, setPropertyValue, validateProperty } from '../../util/propertyUtil'; import { Group, @@ -28,14 +28,14 @@ import { ZEEBE_OUTPUT_TYPE, ZEEBE_PROPERTY_TYPE, ZEEBE_TASK_HEADER_TYPE -} from '../util/bindingTypes'; +} from '../../util/bindingTypes'; import { FeelEntryWithVariableContext, FeelTextAreaEntryWithVariableContext, FeelEntry, FeelTextAreaEntry -} from '../../entries/FeelEntryWithContext'; +} from '../../../entries/FeelEntryWithContext'; const DEFAULT_CUSTOM_GROUP = { diff --git a/src/cloud-element-templates/properties/MessageProps.js b/src/cloud-element-templates/properties-panel/properties/MessageProps.js similarity index 95% rename from src/cloud-element-templates/properties/MessageProps.js rename to src/cloud-element-templates/properties-panel/properties/MessageProps.js index e9532347..69e53f60 100644 --- a/src/cloud-element-templates/properties/MessageProps.js +++ b/src/cloud-element-templates/properties-panel/properties/MessageProps.js @@ -7,7 +7,7 @@ import { } from 'min-dash'; import { isSelectEntryEdited } from '@bpmn-io/properties-panel'; -import ReferenceSelect from '../../entries/ReferenceSelect'; +import ReferenceSelect from '../../../entries/ReferenceSelect'; import { useService } from 'bpmn-js-properties-panel'; @@ -15,7 +15,7 @@ import { getMessage, getMessageEventDefinition, isMessageSupported -} from '../../utils/EventDefinitionUtil'; +} from '../../../utils/EventDefinitionUtil'; import { createElement, @@ -23,7 +23,7 @@ import { findRootElementsByType, getRoot, nextId -} from '../../utils/ElementUtil'; +} from '../../../utils/ElementUtil'; export const EMPTY_OPTION = ''; export const CREATE_NEW_OPTION = 'create-new'; diff --git a/src/cloud-element-templates/properties/index.js b/src/cloud-element-templates/properties-panel/properties/index.js similarity index 100% rename from src/cloud-element-templates/properties/index.js rename to src/cloud-element-templates/properties-panel/properties/index.js diff --git a/src/index.js b/src/index.js index 346bdb97..e410e217 100644 --- a/src/index.js +++ b/src/index.js @@ -3,4 +3,4 @@ export { default as ElementTemplatesPropertiesProviderModule } from './element-t // utils export { Validator as CloudElementTemplatesValidator } from './cloud-element-templates/Validator'; -export { ElementTemplateLinterPlugin as CloudElementTemplatesLinterPlugin } from './cloud-element-templates/LinterPlugin'; +export { ElementTemplateLinterPlugin as CloudElementTemplatesLinterPlugin } from './cloud-element-templates/linting'; diff --git a/test/spec/Example.spec.js b/test/spec/Example.spec.js index 7e53a2bd..3d0ac951 100644 --- a/test/spec/Example.spec.js +++ b/test/spec/Example.spec.js @@ -39,7 +39,7 @@ import ZeebeModdle from 'zeebe-bpmn-moddle/resources/zeebe'; import CloudElementTemplatesPropertiesProviderModule from 'src/cloud-element-templates'; import ElementTemplatesPropertiesProviderModule from 'src/element-templates'; -import { ElementTemplateLinterPlugin } from 'src/cloud-element-templates/LinterPlugin'; +import { ElementTemplateLinterPlugin } from 'src/cloud-element-templates/linting'; const singleStart = window.__env__ && window.__env__.SINGLE_START; diff --git a/test/spec/cloud-element-templates/ElementTemplates.spec.js b/test/spec/cloud-element-templates/ElementTemplates.spec.js index 90f6a369..8c7ff238 100644 --- a/test/spec/cloud-element-templates/ElementTemplates.spec.js +++ b/test/spec/cloud-element-templates/ElementTemplates.spec.js @@ -16,8 +16,7 @@ import { } from 'bpmn-js/lib/util/ModelUtil'; import coreModule from 'bpmn-js/lib/core'; -import elementTemplatesModule from 'src/cloud-element-templates'; -import { BpmnPropertiesPanelModule } from 'bpmn-js-properties-panel'; +import elementTemplatesCoreModule from 'src/cloud-element-templates/core'; import modelingModule from 'bpmn-js/lib/features/modeling'; import zeebeModdlePackage from 'zeebe-bpmn-moddle/resources/zeebe'; @@ -46,12 +45,8 @@ describe('provider/cloud-element-templates - ElementTemplates', function() { container: container, modules: [ coreModule, - elementTemplatesModule, - modelingModule, - BpmnPropertiesPanelModule, - { - propertiesPanel: [ 'value', { registerProvider() {} } ] - } + elementTemplatesCoreModule, + modelingModule ], moddleExtensions: { zeebe: zeebeModdlePackage @@ -996,7 +991,7 @@ describe('provider/cloud-element-templates - ElementTemplates', function() { container: container, modules: [ coreModule, - elementTemplatesModule, + elementTemplatesCoreModule, modelingModule, { propertiesPanel: [ 'value', { registerProvider() {} } ] @@ -1130,12 +1125,8 @@ describe('provider/cloud-element-templates - ElementTemplates - integration', fu container: container, modules: [ coreModule, - elementTemplatesModule, - modelingModule, - BpmnPropertiesPanelModule, - { - propertiesPanel: [ 'value', { registerProvider() {} } ] - } + elementTemplatesCoreModule, + modelingModule ], moddleExtensions: { zeebe: zeebeModdlePackage diff --git a/test/spec/cloud-element-templates/ElementTemplateConditionChecker.spec.js b/test/spec/cloud-element-templates/behavior/ConditionalBehavior.spec.js similarity index 97% rename from test/spec/cloud-element-templates/ElementTemplateConditionChecker.spec.js rename to test/spec/cloud-element-templates/behavior/ConditionalBehavior.spec.js index 24a322fb..2f7a5e2a 100644 --- a/test/spec/cloud-element-templates/ElementTemplateConditionChecker.spec.js +++ b/test/spec/cloud-element-templates/behavior/ConditionalBehavior.spec.js @@ -5,7 +5,7 @@ import { bootstrapModeler, bootstrapPropertiesPanel, inject -} from 'test/TestHelper'; +} from '../../../TestHelper'; import coreModule from 'bpmn-js/lib/core'; import elementTemplatesModule from 'src/cloud-element-templates'; @@ -16,27 +16,27 @@ import { BpmnPropertiesPanelModule } from 'bpmn-js-properties-panel'; import ZeebeBehaviorsModule from 'camunda-bpmn-js-behaviors/lib/camunda-cloud'; -import diagramXML from './fixtures/condition.bpmn'; -import messageDiagramXML from './fixtures/condition-message.bpmn'; -import messageCorrelationDiagramXML from './fixtures/message-correlation-key.bpmn'; +import diagramXML from '../fixtures/condition.bpmn'; +import messageDiagramXML from '../fixtures/condition-message.bpmn'; +import messageCorrelationDiagramXML from '../fixtures/message-correlation-key.bpmn'; -import template from './fixtures/condition.json'; -import updateTemplates from './fixtures/condition-update.json'; +import template from '../fixtures/condition.json'; +import updateTemplates from '../fixtures/condition-update.json'; -import messageTemplates from './fixtures/condition-message.json'; -import messageCorrelationTemplate from './fixtures/message-correlation-key.json'; +import messageTemplates from '../fixtures/condition-message.json'; +import messageCorrelationTemplate from '../fixtures/message-correlation-key.json'; -import calledElementTemplate from './fixtures/condition-called-element.json'; +import calledElementTemplate from '../fixtures/condition-called-element.json'; import { getBusinessObject } from 'bpmn-js/lib/util/ModelUtil'; import { findExtension, findMessage, findZeebeSubscription } from 'src/cloud-element-templates/Helper'; -import ElementTemplatesConditionChecker from 'src/cloud-element-templates/ElementTemplatesConditionChecker'; +import ConditionalBehavior from 'src/cloud-element-templates/behavior/ConditionalBehavior'; import { getBpmnJS } from 'bpmn-js/test/helper'; import { isString } from 'min-dash'; import { query as domQuery } from 'min-dom'; -describe('provider/cloud-element-templates - ElementTemplatesConditionChecker', function() { +describe('provider/cloud-element-templates - ConditionalBehavior', function() { let container; @@ -50,7 +50,6 @@ describe('provider/cloud-element-templates - ElementTemplatesConditionChecker', coreModule, elementTemplatesModule, modelingModule, - ElementTemplatesConditionChecker, BpmnPropertiesPanelModule, { propertiesPanel: [ 'value', { registerProvider() {} } ] @@ -761,7 +760,7 @@ describe('provider/cloud-element-templates - ElementTemplatesConditionChecker', coreModule, elementTemplatesModule, modelingModule, - ElementTemplatesConditionChecker, + ConditionalBehavior, BpmnPropertiesPanelModule, { propertiesPanel: [ 'value', { registerProvider() {} } ] @@ -908,7 +907,7 @@ describe('provider/cloud-element-templates - ElementTemplatesConditionChecker', coreModule, elementTemplatesModule, modelingModule, - ElementTemplatesConditionChecker, + ConditionalBehavior, BpmnPropertiesPanelModule, { propertiesPanel: [ 'value', { registerProvider() {} } ] @@ -933,7 +932,6 @@ describe('provider/cloud-element-templates - ElementTemplatesConditionChecker', coreModule, elementTemplatesModule, modelingModule, - ElementTemplatesConditionChecker, BpmnPropertiesPanelModule, ZeebeBehaviorsModule ], @@ -1233,7 +1231,7 @@ describe('provider/cloud-element-templates - ElementTemplatesConditionChecker', coreModule, elementTemplatesModule, modelingModule, - ElementTemplatesConditionChecker, + ConditionalBehavior, BpmnPropertiesPanelModule, { propertiesPanel: [ 'value', { registerProvider() {} } ] diff --git a/test/spec/cloud-element-templates/GeneratedValueBehavior.bpmn b/test/spec/cloud-element-templates/behavior/GeneratedValueBehavior.bpmn similarity index 100% rename from test/spec/cloud-element-templates/GeneratedValueBehavior.bpmn rename to test/spec/cloud-element-templates/behavior/GeneratedValueBehavior.bpmn diff --git a/test/spec/cloud-element-templates/GeneratedValueBehavior.json b/test/spec/cloud-element-templates/behavior/GeneratedValueBehavior.json similarity index 100% rename from test/spec/cloud-element-templates/GeneratedValueBehavior.json rename to test/spec/cloud-element-templates/behavior/GeneratedValueBehavior.json diff --git a/test/spec/cloud-element-templates/GeneratedValueBehavior.spec.js b/test/spec/cloud-element-templates/behavior/GeneratedValueBehavior.spec.js similarity index 99% rename from test/spec/cloud-element-templates/GeneratedValueBehavior.spec.js rename to test/spec/cloud-element-templates/behavior/GeneratedValueBehavior.spec.js index 9d496d03..69f9180e 100644 --- a/test/spec/cloud-element-templates/GeneratedValueBehavior.spec.js +++ b/test/spec/cloud-element-templates/behavior/GeneratedValueBehavior.spec.js @@ -7,7 +7,7 @@ import zeebeModdlePackage from 'zeebe-bpmn-moddle/resources/zeebe'; import { bootstrapModeler, inject -} from '../../TestHelper'; +} from '../../../TestHelper'; import { BpmnPropertiesPanelModule as BpmnPropertiesPanel } from 'bpmn-js-properties-panel'; import { BpmnPropertiesProviderModule as BpmnPropertiesProvider } from 'bpmn-js-properties-panel'; diff --git a/test/spec/cloud-element-templates/fixtures/referenced-element-behavior.bpmn b/test/spec/cloud-element-templates/behavior/ReferencedElementBehavior.bpmn similarity index 100% rename from test/spec/cloud-element-templates/fixtures/referenced-element-behavior.bpmn rename to test/spec/cloud-element-templates/behavior/ReferencedElementBehavior.bpmn diff --git a/test/spec/cloud-element-templates/fixtures/referenced-element-behavior.json b/test/spec/cloud-element-templates/behavior/ReferencedElementBehavior.json similarity index 100% rename from test/spec/cloud-element-templates/fixtures/referenced-element-behavior.json rename to test/spec/cloud-element-templates/behavior/ReferencedElementBehavior.json diff --git a/test/spec/cloud-element-templates/ReferencedElementBehavior.spec.js b/test/spec/cloud-element-templates/behavior/ReferencedElementBehavior.spec.js similarity index 97% rename from test/spec/cloud-element-templates/ReferencedElementBehavior.spec.js rename to test/spec/cloud-element-templates/behavior/ReferencedElementBehavior.spec.js index 902a669c..27527a5f 100644 --- a/test/spec/cloud-element-templates/ReferencedElementBehavior.spec.js +++ b/test/spec/cloud-element-templates/behavior/ReferencedElementBehavior.spec.js @@ -8,7 +8,7 @@ import { bootstrapModeler, getBpmnJS, inject -} from '../../TestHelper'; +} from '../../../TestHelper'; import { BpmnPropertiesPanelModule as BpmnPropertiesPanel } from 'bpmn-js-properties-panel'; import { BpmnPropertiesProviderModule as BpmnPropertiesProvider } from 'bpmn-js-properties-panel'; @@ -16,8 +16,8 @@ import ElementTemplatesModule from 'src/cloud-element-templates'; import { findMessage, getTemplateId, TEMPLATE_ID_ATTR } from 'src/cloud-element-templates/Helper'; -import diagramXML from './fixtures/referenced-element-behavior.bpmn'; -import templates from './fixtures/referenced-element-behavior.json'; +import diagramXML from './ReferencedElementBehavior.bpmn'; +import templates from './ReferencedElementBehavior.json'; describe('provider/cloud-element-templates - ReferencedElementBehavior', function() { diff --git a/test/spec/cloud-element-templates/ReplaceBehavior.spec.js b/test/spec/cloud-element-templates/behavior/ReplaceBehavior.spec.js similarity index 98% rename from test/spec/cloud-element-templates/ReplaceBehavior.spec.js rename to test/spec/cloud-element-templates/behavior/ReplaceBehavior.spec.js index d0a69ced..7f7385df 100644 --- a/test/spec/cloud-element-templates/ReplaceBehavior.spec.js +++ b/test/spec/cloud-element-templates/behavior/ReplaceBehavior.spec.js @@ -1,7 +1,7 @@ import { bootstrapModeler, inject -} from '../../TestHelper'; +} from '../../../TestHelper'; import { BpmnPropertiesPanelModule as BpmnPropertiesPanel } from 'bpmn-js-properties-panel';import { BpmnPropertiesProviderModule as BpmnPropertiesProvider } from 'bpmn-js-properties-panel'; import ElementTemplatesModule from 'src/cloud-element-templates'; @@ -13,9 +13,9 @@ import zeebeModdlePackage from 'zeebe-bpmn-moddle/resources/zeebe'; import { getBusinessObject } from 'bpmn-js/lib/util/ModelUtil'; -import diagramXML from './fixtures/replace-behavior.bpmn'; +import diagramXML from '../fixtures/replace-behavior.bpmn'; -import elementTemplates from './fixtures/replace-behavior.json'; +import elementTemplates from '../fixtures/replace-behavior.json'; describe('provider/cloud-element-templates - ReplaceBehavior', function() { diff --git a/test/spec/cloud-element-templates/properties/UpdateTemplatePropertiesOrder.bpmn b/test/spec/cloud-element-templates/behavior/UpdatePropertiesOrderBehavior.bpmn similarity index 100% rename from test/spec/cloud-element-templates/properties/UpdateTemplatePropertiesOrder.bpmn rename to test/spec/cloud-element-templates/behavior/UpdatePropertiesOrderBehavior.bpmn diff --git a/test/spec/cloud-element-templates/properties/UpdateTemplatePropertiesOrder.spec.js b/test/spec/cloud-element-templates/behavior/UpdatePropertiesOrderBehavior.spec.js similarity index 97% rename from test/spec/cloud-element-templates/properties/UpdateTemplatePropertiesOrder.spec.js rename to test/spec/cloud-element-templates/behavior/UpdatePropertiesOrderBehavior.spec.js index a0fbe2bf..d1690814 100644 --- a/test/spec/cloud-element-templates/properties/UpdateTemplatePropertiesOrder.spec.js +++ b/test/spec/cloud-element-templates/behavior/UpdatePropertiesOrderBehavior.spec.js @@ -32,7 +32,7 @@ import { } from 'src/cloud-element-templates/Helper'; -describe('provider/cloud-element-templates - UpdateTemplatePropertiesOrder', function() { +describe('provider/cloud-element-templates - UpdatePropertiesOrderBehavior', function() { let container, propertiesContainer, modelerContainer; @@ -52,8 +52,8 @@ describe('provider/cloud-element-templates - UpdateTemplatePropertiesOrder', fun describe('should preserve definition order on update', function() { - const elementTemplates = require('./UpdateTemplatePropertiesOrder.json'); - const diagramXML = require('./UpdateTemplatePropertiesOrder.bpmn').default; + const elementTemplates = require('./UpdatePropertiesOrderBehavior.template.json'); + const diagramXML = require('./UpdatePropertiesOrderBehavior.bpmn').default; beforeEach(() => bootstrapModeler(diagramXML, { container: modelerContainer, @@ -409,8 +409,8 @@ describe('provider/cloud-element-templates - UpdateTemplatePropertiesOrder', fun describe('should correct definition order on update', function() { - const elementTemplates = require('./UpdateTemplatePropertiesOrder.json'); - const diagramXML = require('./UpdateTemplatePropertiesOrder.wrong-order.bpmn').default; + const elementTemplates = require('./UpdatePropertiesOrderBehavior.template.json'); + const diagramXML = require('./UpdatePropertiesOrderBehavior.wrong-order.bpmn').default; beforeEach(() => bootstrapModeler(diagramXML, { container: modelerContainer, diff --git a/test/spec/cloud-element-templates/properties/UpdateTemplatePropertiesOrder.json b/test/spec/cloud-element-templates/behavior/UpdatePropertiesOrderBehavior.template.json similarity index 100% rename from test/spec/cloud-element-templates/properties/UpdateTemplatePropertiesOrder.json rename to test/spec/cloud-element-templates/behavior/UpdatePropertiesOrderBehavior.template.json diff --git a/test/spec/cloud-element-templates/properties/UpdateTemplatePropertiesOrder.wrong-order.bpmn b/test/spec/cloud-element-templates/behavior/UpdatePropertiesOrderBehavior.wrong-order.bpmn similarity index 100% rename from test/spec/cloud-element-templates/properties/UpdateTemplatePropertiesOrder.wrong-order.bpmn rename to test/spec/cloud-element-templates/behavior/UpdatePropertiesOrderBehavior.wrong-order.bpmn diff --git a/test/spec/cloud-element-templates/linting/LinterPlugin.json b/test/spec/cloud-element-templates/linting/LinterPlugin.json new file mode 100644 index 00000000..84fc6d08 --- /dev/null +++ b/test/spec/cloud-element-templates/linting/LinterPlugin.json @@ -0,0 +1,154 @@ +[ + { + "$schema": "https://unpkg.com/@camunda/zeebe-element-templates-json-schema/resources/schema.json", + "name": "empty", + "id": "constraints.empty", + "appliesTo": [ + "bpmn:Task" + ], + "properties": [] + }, + { + "$schema": "https://unpkg.com/@camunda/zeebe-element-templates-json-schema/resources/schema.json", + "name": "Constraints - Min Length", + "id": "constraints.minLength", + "appliesTo": [ + "bpmn:Task" + ], + "properties": [ + { + "label": "Test Property", + "type": "String", + "binding": { + "type": "property", + "name": "name" + }, + "constraints": { + "minLength": 5 + } + } + ] + }, + { + "$schema": "https://unpkg.com/@camunda/zeebe-element-templates-json-schema/resources/schema.json", + "name": "Constraints - Max Length", + "id": "constraints.maxLength", + "appliesTo": [ + "bpmn:Task" + ], + "properties": [ + { + "label": "Test Property", + "type": "String", + "binding": { + "type": "property", + "name": "name" + }, + "constraints": { + "maxLength": 5 + } + } + ] + }, + { + "$schema": "https://unpkg.com/@camunda/zeebe-element-templates-json-schema/resources/schema.json", + "name": "Constraints - not Empty", + "id": "constraints.notEmpty", + "appliesTo": [ + "bpmn:Task" + ], + "properties": [ + { + "label": "Test Property", + "type": "String", + "binding": { + "type": "property", + "name": "name" + }, + "constraints": { + "notEmpty": true + } + } + ] + }, + { + "$schema": "https://unpkg.com/@camunda/zeebe-element-templates-json-schema/resources/schema.json", + "name": "Constraints - Pattern", + "id": "constraints.pattern", + "appliesTo": [ + "bpmn:Task" + ], + "properties": [ + { + "label": "Test Property", + "type": "String", + "binding": { + "type": "property", + "name": "name" + }, + "constraints": { + "pattern": "A+B" + } + } + ] + }, + { + "$schema": "https://unpkg.com/@camunda/zeebe-element-templates-json-schema/resources/schema.json", + "name": "Constraints - Pattern (custom message)", + "id": "constraints.pattern-custom-message", + "appliesTo": [ + "bpmn:Task" + ], + "properties": [ + { + "label": "Test Property", + "type": "String", + "binding": { + "type": "property", + "name": "name" + }, + "constraints": { + "pattern": { + "value": "A+B", + "message": "This is a custom message" + } + } + } + ] + }, + { + "$schema": "https://unpkg.com/@camunda/zeebe-element-templates-json-schema/resources/schema.json", + "name": "Constraints - Conditional", + "id": "constraints.conditional", + "appliesTo": [ + "bpmn:Task" + ], + "properties": [ + { + "id": "nameProperty", + "type": "Hidden", + "binding": { + "type": "property", + "name": "name" + } + }, + { + "label": "Test Property", + "type": "String", + "binding": { + "type": "property", + "name": "name" + }, + "constraints": { + "pattern": { + "value": "A+B" + } + }, + "condition": { + "property": "nameProperty", + "equals": "foo" + } + } + ] + } +] \ No newline at end of file diff --git a/test/spec/cloud-element-templates/LinterPlugin.spec.js b/test/spec/cloud-element-templates/linting/LinterPlugin.spec.js similarity index 97% rename from test/spec/cloud-element-templates/LinterPlugin.spec.js rename to test/spec/cloud-element-templates/linting/LinterPlugin.spec.js index 5e2108a3..45f7917d 100644 --- a/test/spec/cloud-element-templates/LinterPlugin.spec.js +++ b/test/spec/cloud-element-templates/linting/LinterPlugin.spec.js @@ -1,14 +1,14 @@ import RuleTester from 'bpmnlint/lib/testers/rule-tester'; -import { elementTemplateLintRule } from 'src/cloud-element-templates/LinterPlugin.js'; +import { elementTemplateLintRule } from 'src/cloud-element-templates/linting'; import { createDefinitions, createModdle, createProcess -} from '../../TestHelper'; +} from '../../../TestHelper'; -import templates from './fixtures/constraints.json'; +import templates from './LinterPlugin.json'; const valid = [ { diff --git a/test/spec/cloud-element-templates/ElementTemplatesPropertiesProvider.bpmn b/test/spec/cloud-element-templates/properties-panel/ElementTemplatesPropertiesProvider.bpmn similarity index 100% rename from test/spec/cloud-element-templates/ElementTemplatesPropertiesProvider.bpmn rename to test/spec/cloud-element-templates/properties-panel/ElementTemplatesPropertiesProvider.bpmn diff --git a/test/spec/cloud-element-templates/fixtures/entries-visible.bpmn b/test/spec/cloud-element-templates/properties-panel/ElementTemplatesPropertiesProvider.entries-visible.bpmn similarity index 100% rename from test/spec/cloud-element-templates/fixtures/entries-visible.bpmn rename to test/spec/cloud-element-templates/properties-panel/ElementTemplatesPropertiesProvider.entries-visible.bpmn diff --git a/test/spec/cloud-element-templates/fixtures/entries-visible.json b/test/spec/cloud-element-templates/properties-panel/ElementTemplatesPropertiesProvider.entries-visible.json similarity index 100% rename from test/spec/cloud-element-templates/fixtures/entries-visible.json rename to test/spec/cloud-element-templates/properties-panel/ElementTemplatesPropertiesProvider.entries-visible.json diff --git a/test/spec/cloud-element-templates/ElementTemplatesPropertiesProvider.templates.json b/test/spec/cloud-element-templates/properties-panel/ElementTemplatesPropertiesProvider.json similarity index 100% rename from test/spec/cloud-element-templates/ElementTemplatesPropertiesProvider.templates.json rename to test/spec/cloud-element-templates/properties-panel/ElementTemplatesPropertiesProvider.json diff --git a/test/spec/cloud-element-templates/ElementTemplatesPropertiesProvider.spec.js b/test/spec/cloud-element-templates/properties-panel/ElementTemplatesPropertiesProvider.spec.js similarity index 97% rename from test/spec/cloud-element-templates/ElementTemplatesPropertiesProvider.spec.js rename to test/spec/cloud-element-templates/properties-panel/ElementTemplatesPropertiesProvider.spec.js index 2f93dd28..4615e034 100644 --- a/test/spec/cloud-element-templates/ElementTemplatesPropertiesProvider.spec.js +++ b/test/spec/cloud-element-templates/properties-panel/ElementTemplatesPropertiesProvider.spec.js @@ -20,25 +20,25 @@ import zeebeModdlePackage from 'zeebe-bpmn-moddle/resources/zeebe'; import { bootstrapPropertiesPanel, clickInput as click, + changeInput, inject -} from 'test/TestHelper'; +} from '../../../TestHelper'; import { BpmnPropertiesPanelModule as BpmnPropertiesPanel } from 'bpmn-js-properties-panel'; import elementTemplatesModule from 'src/cloud-element-templates'; import { BpmnPropertiesProviderModule as BpmnPropertiesProvider } from 'bpmn-js-properties-panel'; import diagramXML from './ElementTemplatesPropertiesProvider.bpmn'; -import templates from './ElementTemplatesPropertiesProvider.templates.json'; -import entriesVisibleDiagramXML from './fixtures/entries-visible.bpmn'; -import entriesVisibleTemplates from './fixtures/entries-visible.json'; +import templates from './ElementTemplatesPropertiesProvider.json'; +import entriesVisibleDiagramXML from './ElementTemplatesPropertiesProvider.entries-visible.bpmn'; +import entriesVisibleTemplates from './ElementTemplatesPropertiesProvider.entries-visible.json'; -import conditionTemplate from './fixtures/condition.json'; -import multipleConditionTemplate from './fixtures/multiple-conditions.json'; -import conditionXML from './fixtures/condition.bpmn'; -import { changeInput } from '../../TestHelper'; +import conditionTemplate from '../fixtures/condition.json'; +import multipleConditionTemplate from '../fixtures/multiple-conditions.json'; +import conditionXML from '../fixtures/condition.bpmn'; -describe('provider/cloud-element-templates - ElementTemplates', function() { +describe('provider/cloud-element-templates - ElementTemplatesPropertiesProvider', function() { let container; diff --git a/test/spec/cloud-element-templates/properties/CustomProperties.spec.js b/test/spec/cloud-element-templates/properties/CustomProperties.spec.js index 1efd063f..7d429c22 100644 --- a/test/spec/cloud-element-templates/properties/CustomProperties.spec.js +++ b/test/spec/cloud-element-templates/properties/CustomProperties.spec.js @@ -40,7 +40,8 @@ import zeebeModdlePackage from 'zeebe-bpmn-moddle/resources/zeebe'; import { getBusinessObject } from 'bpmn-js/lib/util/ModelUtil'; -import { BpmnPropertiesPanelModule as BpmnPropertiesPanel } from 'bpmn-js-properties-panel';import elementTemplatesModule from 'src/cloud-element-templates'; +import { BpmnPropertiesPanelModule as BpmnPropertiesPanel } from 'bpmn-js-properties-panel'; +import elementTemplatesModule from 'src/cloud-element-templates'; import diagramXML from './CustomProperties.bpmn'; import templates from './CustomProperties.json';