Skip to content
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
3 changes: 2 additions & 1 deletion src/component/parser/json/converter/ProcessConverter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,13 @@ const computeSubProcessKind = (processedSemanticType: BpmnSemanticType, bpmnElem
}
};

// semantically speaking, artifacts are not FlowNodes, but for the purpose of conversion, we consider them as FlowNodes here
const orderedFlowNodeBpmnTypes: BpmnSemanticType[] = [
// specific management for adhoc and transaction sub-processes which are handled with a dedicated ShapeBpmnSubProcessKind
'adHocSubProcess',
'transaction',
// process boundary events afterward as we need its parent activity to be available when building it
...(ShapeUtil.flowNodeKinds().filter(kind => kind !== ShapeBpmnElementKind.EVENT_BOUNDARY) as BpmnSemanticType[]),
...([...ShapeUtil.flowNodeKinds(), ...ShapeUtil.artifactKinds()].filter(kind => kind !== ShapeBpmnElementKind.EVENT_BOUNDARY) as BpmnSemanticType[]),
ShapeBpmnElementKind.EVENT_BOUNDARY,
];

Expand Down
2 changes: 1 addition & 1 deletion src/model/bpmn/internal/shape/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export class ShapeUtil {
}

static flowNodeKinds(): ShapeBpmnElementKind[] {
return Object.values(ShapeBpmnElementKind).filter(kind => !ShapeUtil.isPoolOrLane(kind));
return Object.values(ShapeBpmnElementKind).filter(kind => !ShapeUtil.isPoolOrLane(kind) && !ShapeUtil.isArtifact(kind));
}

/**
Expand Down
10 changes: 10 additions & 0 deletions test/unit/component/mxgraph/renderer/StyleComputer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -556,13 +556,23 @@ describe('Style Computer', () => {
const additionalColorsStyle = expectAdditionalColorsStyle ? ';fillColor=#000003;strokeColor=#FF0203;fontColor=#010101' : '';
expect(computeStyleWithRendererOptions(shape)).toBe(`${kind}${additionalColorsStyle}`);
});

it.each([ShapeBpmnElementKind.LANE, ShapeBpmnElementKind.POOL])('%s', (kind: ShapeBpmnElementKind) => {
const shape = newShape(newShapeBpmnElement(kind), newLabelExtension('#aa0101'));
shape.extensions.fillColor = '#AA0003';
shape.extensions.strokeColor = '#FF02AA';
const additionalColorsStyle = expectAdditionalColorsStyle ? ';fillColor=#AA0003;swimlaneFillColor=#AA0003;strokeColor=#FF02AA;fontColor=#aa0101' : '';
expect(computeStyleWithRendererOptions(shape)).toBe(`${kind};horizontal=1${additionalColorsStyle}`);
});

it.each([ShapeBpmnElementKind.GROUP, ShapeBpmnElementKind.TEXT_ANNOTATION])('%s', (kind: ShapeBpmnElementKind) => {
const shape = newShape(newShapeBpmnElement(kind), newLabelExtension('#aa0101'));
shape.extensions.fillColor = '#AA0003';
shape.extensions.strokeColor = '#FF02AA';
const additionalColorsStyle = expectAdditionalColorsStyle ? ';fillColor=#AA0003;strokeColor=#FF02AA;fontColor=#aa0101' : '';
expect(computeStyleWithRendererOptions(shape)).toBe(`${kind}${additionalColorsStyle}`);
});

it('no extension', () => {
const shape = newShape(newShapeBpmnElement(ShapeBpmnElementKind.TASK));
expect(computeStyleWithRendererOptions(shape)).toBe(`task`);
Expand Down
13 changes: 8 additions & 5 deletions test/unit/model/bpmn/internal/shape/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,13 @@ describe('ShapeUtil', () => {

it('flow node kinds', () => {
const flowNodeKinds = ShapeUtil.flowNodeKinds();
expect(flowNodeKinds).toContain(ShapeBpmnElementKind.TASK);
expect(flowNodeKinds).toContain(ShapeBpmnElementKind.EVENT_INTERMEDIATE_CATCH);
expect(flowNodeKinds).toContain(ShapeBpmnElementKind.GROUP); // artifact should not be included

expect(flowNodeKinds).toEqual(expect.arrayContaining(ShapeUtil.activityKinds()));
expect(flowNodeKinds).toEqual(expect.arrayContaining(ShapeUtil.eventKinds()));
expect(flowNodeKinds).toEqual(expect.arrayContaining(ShapeUtil.gatewayKinds()));

expect(flowNodeKinds).not.toContain(ShapeBpmnElementKind.POOL);
expect(flowNodeKinds).not.toContain(ShapeBpmnElementKind.GROUP);
});

it('artifact kinds', () => {
Expand Down Expand Up @@ -90,8 +93,8 @@ describe('ShapeUtil', () => {
${ShapeBpmnElementKind.CALL_ACTIVITY} | ${true}
${ShapeBpmnElementKind.POOL} | ${false}
${ShapeBpmnElementKind.LANE} | ${false}
${ShapeBpmnElementKind.GROUP} | ${true}
${ShapeBpmnElementKind.TEXT_ANNOTATION} | ${true}
${ShapeBpmnElementKind.GROUP} | ${false}
${ShapeBpmnElementKind.TEXT_ANNOTATION} | ${false}
${FlowKind.MESSAGE_FLOW} | ${false}
${'unknown'} | ${false}
${'receiveTask'} | ${true}
Expand Down