From 407c209a8b4fdd961dbb5d3e2a458f68ad812c92 Mon Sep 17 00:00:00 2001 From: Maciej Barelkowski Date: Thu, 14 Dec 2023 10:48:36 +0100 Subject: [PATCH] feat: allow collapsed subprocess in 8.4 Related to https://github.com/camunda/camunda-modeler/issues/4020 --- lib/utils/error-messages.js | 8 ++++---- test/spec/utils/error-messages.spec.js | 9 +++++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/lib/utils/error-messages.js b/lib/utils/error-messages.js index 5e3455f..862c653 100644 --- a/lib/utils/error-messages.js +++ b/lib/utils/error-messages.js @@ -86,7 +86,7 @@ export function getErrorMessage(report, executionPlatform, executionPlatformVers } if (type === ERROR_TYPES.ELEMENT_COLLAPSED_NOT_ALLOWED) { - return getElementCollapsedNotAllowedErrorMessage(report); + return getElementCollapsedNotAllowedErrorMessage(report, executionPlatform, executionPlatformVersion); } if (type === ERROR_TYPES.ELEMENT_PROPERTY_VALUE_DUPLICATED) { @@ -176,18 +176,18 @@ function getChildElementTypeNotAllowedErrorMessage(report, executionPlatform, ex ); } -function getElementCollapsedNotAllowedErrorMessage(report) { +function getElementCollapsedNotAllowedErrorMessage(report, executionPlatform, executionPlatformVersion) { const { data, message } = report; - const { node } = data; + const { allowedVersion, node } = data; const typeString = getTypeString(node); if (is(node, 'bpmn:SubProcess')) { - return `${ getIndefiniteArticle(typeString) } <${ typeString }> must be expanded`; + return getSupportedMessage(`A collapsed <${typeString}>`, executionPlatform, executionPlatformVersion, allowedVersion); } return message; diff --git a/test/spec/utils/error-messages.spec.js b/test/spec/utils/error-messages.spec.js index f69e966..2fea82f 100644 --- a/test/spec/utils/error-messages.spec.js +++ b/test/spec/utils/error-messages.spec.js @@ -227,10 +227,10 @@ describe('utils/error-messages', function() { const report = await getLintError(di, rule); // when - const errorMessage = getErrorMessage(report); + const errorMessage = getErrorMessage(report, 'Camunda Cloud', '8.3'); // then - expect(errorMessage).to.equal('A must be expanded'); + expect(errorMessage).to.equal('A collapsed is only supported by Camunda 8.4 or newer'); }); @@ -247,10 +247,11 @@ describe('utils/error-messages', function() { const report = await getLintError(di, rule); // when - const errorMessage = getErrorMessage(report); + const errorMessage = getErrorMessage(report, 'Camunda Cloud', '8.3'); // then - expect(errorMessage).to.equal('An must be expanded'); + console.log(errorMessage); + expect(errorMessage).to.equal('A collapsed is only supported by Camunda 8.4 or newer'); }); });