From 71723efc2285866ebedde51016f67771ed8a5578 Mon Sep 17 00:00:00 2001 From: Martin Stamm Date: Thu, 17 Aug 2023 10:30:43 +0200 Subject: [PATCH] revert(provider): scope variables to current element This reverts commit db4efee0c574e9b2b84c66c57a9bcedbc7b99522. related to https://github.com/camunda/camunda-modeler/issues/3728 --- lib/variableProvider/ExampleJsonProvider.js | 11 +------ test/fixtures/simple.bpmn | 9 ++---- test/spec/integration.spec.js | 35 +++------------------ test/spec/variableProvider.spec.js | 22 ------------- 4 files changed, 9 insertions(+), 68 deletions(-) diff --git a/lib/variableProvider/ExampleJsonProvider.js b/lib/variableProvider/ExampleJsonProvider.js index 5ad6298..78f5379 100644 --- a/lib/variableProvider/ExampleJsonProvider.js +++ b/lib/variableProvider/ExampleJsonProvider.js @@ -13,16 +13,7 @@ export class ExampleJsonProvider extends VariableProvider { } const parsedData = getVariablesFromString(data); - - // Scope data to current element only - const result = parsedData.map(variable => { - return { - ...variable, - scope: element - }; - }); - - return result; + return parsedData; } } diff --git a/test/fixtures/simple.bpmn b/test/fixtures/simple.bpmn index c620fa8..7475f71 100644 --- a/test/fixtures/simple.bpmn +++ b/test/fixtures/simple.bpmn @@ -1,14 +1,11 @@ - + - + - - - Flow_16gvdav @@ -48,4 +45,4 @@ - + \ No newline at end of file diff --git a/test/spec/integration.spec.js b/test/spec/integration.spec.js index f80e0ed..407e5ae 100644 --- a/test/spec/integration.spec.js +++ b/test/spec/integration.spec.js @@ -137,43 +137,18 @@ describe('Integration', function() { beforeEach(() => createModeler(simpleXML)); - it('should scope variables to element', inject(async function(elementRegistry, variableResolver) { + it('should supply variables to variableResolver', inject(async function(elementRegistry, variableResolver) { // given - const process = elementRegistry.get('Process_1'); + const task = elementRegistry.get('ServiceTask_1'); // when - const variables = await variableResolver.getProcessVariables(process); + const variables = await variableResolver.getVariablesForElement(task); // then expect(variables).to.variableEqual([ - { name: 'output', type: 'Number', scope: 'ServiceTask_1' }, - { name: 'startData', type: 'Context', scope: 'StartEvent_1' }, - { name: 'mappedStartData', type: 'Context', scope: 'Process_1' }, - ]); - })); - - - it('should keep info through mappings', inject(async function(elementRegistry, variableResolver) { - - // given - const process = elementRegistry.get('Process_1'); - - // when - const variables = await variableResolver.getVariablesForElement(process); - - // then - expect(variables).to.variableEqual([ - { - name: 'mappedStartData', - type: 'Context', - entries: [ - { - name: 'foobar', - type: 'Number' - } - ] - } + { name: 'output', type: 'Number' }, + { name: 'startData', type: 'String' } ]); })); diff --git a/test/spec/variableProvider.spec.js b/test/spec/variableProvider.spec.js index 4a4d67c..06922b1 100644 --- a/test/spec/variableProvider.spec.js +++ b/test/spec/variableProvider.spec.js @@ -120,28 +120,6 @@ describe('variable-provider', function() { }); - it('should scope variables to element', function() { - - // given - const variables = JSON.stringify({ - string: 'string', - }); - - const element = createElementWithVariables(variables); - - // when - const result = provider.getVariables(element); - - // then - expect(result).to.variableEqual([ - { - name: 'string', - scope: element.id - } - ]); - }); - - it('should NOT break with malformed JSON', function() { // given