Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix!: generate correct CSS class name for adhoc subprocess #3058

Merged
merged 4 commits into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/model/bpmn/internal/shape/kinds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ export enum ShapeBpmnMarkerKind {
* @category BPMN
*/
export enum ShapeBpmnSubProcessKind {
AD_HOC = 'ad_hoc',
AD_HOC = 'adhoc',
EMBEDDED = 'embedded',
EVENT = 'event',
TRANSACTION = 'transaction',
Expand Down
54 changes: 27 additions & 27 deletions test/unit/component/mxgraph/renderer/style-utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ limitations under the License.
*/

import { computeBpmnBaseClassName, computeAllBpmnClassNames } from '@lib/component/mxgraph/renderer/style-utils';
import { FlowKind, ShapeBpmnElementKind } from '@lib/model/bpmn/internal';
import { FlowKind, SequenceFlowKind, ShapeBpmnElementKind, ShapeBpmnEventBasedGatewayKind, ShapeBpmnEventDefinitionKind, ShapeBpmnSubProcessKind } from '@lib/model/bpmn/internal';

describe('compute base css class names of BPMN elements', () => {
it.each`
Expand Down Expand Up @@ -44,32 +44,32 @@ describe('compute base css class names of BPMN elements', () => {

describe('compute all css class names based on style input', () => {
it.each`
style | isLabel | expectedClassNames
${ShapeBpmnElementKind.LANE} | ${true} | ${['bpmn-type-container', 'bpmn-lane', 'bpmn-label']}
${ShapeBpmnElementKind.POOL} | ${false} | ${['bpmn-type-container', 'bpmn-pool']}
${ShapeBpmnElementKind.CALL_ACTIVITY} | ${false} | ${['bpmn-type-activity', 'bpmn-call-activity']}
${'callActivity;bpmn.globalTaskKind=globalTask'} | ${false} | ${['bpmn-type-activity', 'bpmn-call-activity', 'bpmn-global-task']}
${'callActivity;bpmn.globalTaskKind=globalManualTask'} | ${true} | ${['bpmn-type-activity', 'bpmn-call-activity', 'bpmn-global-manual-task', 'bpmn-label']}
${ShapeBpmnElementKind.EVENT_BOUNDARY} | ${true} | ${['bpmn-type-event', 'bpmn-boundary-event', 'bpmn-label']}
${'boundaryEvent;bpmn.eventDefinitionKind=cancel;bpmn.isInterrupting=true'} | ${true} | ${['bpmn-type-event', 'bpmn-boundary-event', 'bpmn-event-def-cancel', 'bpmn-label']}
${ShapeBpmnElementKind.EVENT_INTERMEDIATE_THROW} | ${false} | ${['bpmn-type-event', 'bpmn-intermediate-throw-event']}
${'startEvent;bpmn.eventDefinitionKind=timer;bpmn.isInterrupting=false;fontStyle=2'} | ${false} | ${['bpmn-type-event', 'bpmn-start-event', 'bpmn-event-def-timer']}
${ShapeBpmnElementKind.GATEWAY_EVENT_BASED} | ${true} | ${['bpmn-type-gateway', 'bpmn-event-based-gateway', 'bpmn-label']}
${'eventBasedGateway;bpmn.isInstantiating=true;bpmn.gatewayKind=Parallel'} | ${false} | ${['bpmn-type-gateway', 'bpmn-event-based-gateway', 'bpmn-gateway-kind-parallel']}
${ShapeBpmnElementKind.GATEWAY_EXCLUSIVE} | ${true} | ${['bpmn-type-gateway', 'bpmn-exclusive-gateway', 'bpmn-label']}
${ShapeBpmnElementKind.TASK} | ${true} | ${['bpmn-type-activity', 'bpmn-type-task', 'bpmn-task', 'bpmn-label']}
${ShapeBpmnElementKind.TASK_BUSINESS_RULE} | ${false} | ${['bpmn-type-activity', 'bpmn-type-task', 'bpmn-business-rule-task']}
${ShapeBpmnElementKind.SUB_PROCESS} | ${false} | ${['bpmn-type-activity', 'bpmn-sub-process']}
${'subProcess;bpmn.subProcessKind=adHoc'} | ${true} | ${['bpmn-type-activity', 'bpmn-sub-process', 'bpmn-sub-process-adhoc', 'bpmn-label']}
${'subProcess;bpmn.subProcessKind=embedded'} | ${false} | ${['bpmn-type-activity', 'bpmn-sub-process', 'bpmn-sub-process-embedded']}
${'subProcess;bpmn.subProcessKind=event'} | ${true} | ${['bpmn-type-activity', 'bpmn-sub-process', 'bpmn-sub-process-event', 'bpmn-label']}
${'subProcess;bpmn.subProcessKind=transaction'} | ${true} | ${['bpmn-type-activity', 'bpmn-sub-process', 'bpmn-sub-process-transaction', 'bpmn-label']}
${FlowKind.ASSOCIATION_FLOW} | ${true} | ${['bpmn-type-flow', 'bpmn-association', 'bpmn-label']}
${FlowKind.MESSAGE_FLOW} | ${false} | ${['bpmn-type-flow', 'bpmn-message-flow']}
${'sequenceFlow;default;fontStyle=4'} | ${false} | ${['bpmn-type-flow', 'bpmn-sequence-flow']}
${'shape=bpmn.message-flow-icon'} | ${false} | ${['bpmn-message-flow-icon']}
${'shape=bpmn.message-flow-icon;bpmn.isInitiating=false'} | ${false} | ${['bpmn-message-flow-icon', 'bpmn-icon-non-initiating']}
${'shape=bpmn.message-flow-icon;bpmn.isInitiating=true'} | ${true} | ${['bpmn-message-flow-icon', 'bpmn-icon-initiating', 'bpmn-label']}
style | isLabel | expectedClassNames
${ShapeBpmnElementKind.LANE} | ${true} | ${['bpmn-type-container', 'bpmn-lane', 'bpmn-label']}
${ShapeBpmnElementKind.POOL} | ${false} | ${['bpmn-type-container', 'bpmn-pool']}
${ShapeBpmnElementKind.CALL_ACTIVITY} | ${false} | ${['bpmn-type-activity', 'bpmn-call-activity']}
${`${ShapeBpmnElementKind.CALL_ACTIVITY};bpmn.globalTaskKind=${ShapeBpmnElementKind.GLOBAL_TASK}`} | ${false} | ${['bpmn-type-activity', 'bpmn-call-activity', 'bpmn-global-task']}
${`${ShapeBpmnElementKind.CALL_ACTIVITY};bpmn.globalTaskKind=${ShapeBpmnElementKind.GLOBAL_TASK_MANUAL}`} | ${true} | ${['bpmn-type-activity', 'bpmn-call-activity', 'bpmn-global-manual-task', 'bpmn-label']}
${ShapeBpmnElementKind.EVENT_BOUNDARY} | ${true} | ${['bpmn-type-event', 'bpmn-boundary-event', 'bpmn-label']}
${`${ShapeBpmnElementKind.EVENT_BOUNDARY};bpmn.eventDefinitionKind=${ShapeBpmnEventDefinitionKind.CANCEL};bpmn.isInterrupting=true`} | ${true} | ${['bpmn-type-event', 'bpmn-boundary-event', 'bpmn-event-def-cancel', 'bpmn-label']}
${ShapeBpmnElementKind.EVENT_INTERMEDIATE_THROW} | ${false} | ${['bpmn-type-event', 'bpmn-intermediate-throw-event']}
${`${ShapeBpmnElementKind.EVENT_START};bpmn.eventDefinitionKind=${ShapeBpmnEventDefinitionKind.TIMER};bpmn.isInterrupting=false;fontStyle=2`} | ${false} | ${['bpmn-type-event', 'bpmn-start-event', 'bpmn-event-def-timer']}
${ShapeBpmnElementKind.GATEWAY_EVENT_BASED} | ${true} | ${['bpmn-type-gateway', 'bpmn-event-based-gateway', 'bpmn-label']}
${`${ShapeBpmnElementKind.GATEWAY_EVENT_BASED};bpmn.isInstantiating=true;bpmn.gatewayKind=${ShapeBpmnEventBasedGatewayKind.Parallel}`} | ${false} | ${['bpmn-type-gateway', 'bpmn-event-based-gateway', 'bpmn-gateway-kind-parallel']}
${ShapeBpmnElementKind.GATEWAY_EXCLUSIVE} | ${true} | ${['bpmn-type-gateway', 'bpmn-exclusive-gateway', 'bpmn-label']}
${ShapeBpmnElementKind.TASK} | ${true} | ${['bpmn-type-activity', 'bpmn-type-task', 'bpmn-task', 'bpmn-label']}
${ShapeBpmnElementKind.TASK_BUSINESS_RULE} | ${false} | ${['bpmn-type-activity', 'bpmn-type-task', 'bpmn-business-rule-task']}
${ShapeBpmnElementKind.SUB_PROCESS} | ${false} | ${['bpmn-type-activity', 'bpmn-sub-process']}
${`${ShapeBpmnElementKind.SUB_PROCESS};bpmn.subProcessKind=${ShapeBpmnSubProcessKind.AD_HOC}`} | ${true} | ${['bpmn-type-activity', 'bpmn-sub-process', 'bpmn-sub-process-adhoc', 'bpmn-label']}
${`${ShapeBpmnElementKind.SUB_PROCESS};bpmn.subProcessKind=${ShapeBpmnSubProcessKind.EMBEDDED}`} | ${false} | ${['bpmn-type-activity', 'bpmn-sub-process', 'bpmn-sub-process-embedded']}
${`${ShapeBpmnElementKind.SUB_PROCESS};bpmn.subProcessKind=${ShapeBpmnSubProcessKind.EVENT}`} | ${true} | ${['bpmn-type-activity', 'bpmn-sub-process', 'bpmn-sub-process-event', 'bpmn-label']}
${`${ShapeBpmnElementKind.SUB_PROCESS};bpmn.subProcessKind=${ShapeBpmnSubProcessKind.TRANSACTION}`} | ${true} | ${['bpmn-type-activity', 'bpmn-sub-process', 'bpmn-sub-process-transaction', 'bpmn-label']}
${FlowKind.ASSOCIATION_FLOW} | ${true} | ${['bpmn-type-flow', 'bpmn-association', 'bpmn-label']}
${FlowKind.MESSAGE_FLOW} | ${false} | ${['bpmn-type-flow', 'bpmn-message-flow']}
${`${FlowKind.SEQUENCE_FLOW};${SequenceFlowKind.DEFAULT};fontStyle=4`} | ${false} | ${['bpmn-type-flow', 'bpmn-sequence-flow']}
${'shape=bpmn.message-flow-icon'} | ${false} | ${['bpmn-message-flow-icon']}
${'shape=bpmn.message-flow-icon;bpmn.isInitiating=false'} | ${false} | ${['bpmn-message-flow-icon', 'bpmn-icon-non-initiating']}
${'shape=bpmn.message-flow-icon;bpmn.isInitiating=true'} | ${true} | ${['bpmn-message-flow-icon', 'bpmn-icon-initiating', 'bpmn-label']}
`('style="$style" / isLabel=$isLabel', ({ style, isLabel, expectedClassNames }: { style: string; isLabel: boolean; expectedClassNames: string[] }) => {
expect(computeAllBpmnClassNames(style, isLabel)).toEqual(expectedClassNames);
});
Expand Down
Loading