Skip to content

Commit

Permalink
fix: restrict taskDefinition for zeebeServiceTasks only
Browse files Browse the repository at this point in the history
- Only allow `zeebeServiceTasks` to have `taskDefinition` elements , instead of allowing it to all elements
  • Loading branch information
smbea committed Sep 20, 2021
1 parent b90022e commit 0d1a410
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 0 deletions.
5 changes: 5 additions & 0 deletions resources/zeebe.json
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,11 @@
"superClass": [
"Element"
],
"meta": {
"allowedIn": [
"zeebe:ZeebeServiceTask"
]
},
"properties": [
{
"name": "type",
Expand Down
58 changes: 58 additions & 0 deletions test/spec/extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,64 @@ describe('extension - can copy', function() {

});


describe('<zeebe:TaskDefinition>', function() {

it('should allow on ServiceTask', function() {

// given
var taskDefinition = moddle.create('zeebe:TaskDefinition'),
serviceTask = moddle.create('bpmn:ServiceTask'),
extensionElements = moddle.create('bpmn:ExtensionElements');

taskDefinition.$parent = extensionElements;
extensionElements.$parent = serviceTask;

// when
var canCopyProperty = zeebeModdleExtension.canCopyProperty(taskDefinition, extensionElements);

// then
expect(canCopyProperty).not.to.be.false;
});


it('should not allow on Task', function() {

// given
var taskDefinition = moddle.create('zeebe:TaskDefinition'),
task = moddle.create('bpmn:Task'),
extensionElements = moddle.create('bpmn:ExtensionElements');

taskDefinition.$parent = extensionElements;
extensionElements.$parent = task;

// when
var canCopyProperty = zeebeModdleExtension.canCopyProperty(taskDefinition, extensionElements);

// then
expect(canCopyProperty).to.be.false;
});


it('should not allow on StartEvent', function() {

// given
var taskDefinition = moddle.create('zeebe:TaskDefinition'),
startEvent = moddle.create('bpmn:StartEvent'),
extensionElements = moddle.create('bpmn:ExtensionElements');

taskDefinition.$parent = extensionElements;
extensionElements.$parent = startEvent;

// when
var canCopyProperty = zeebeModdleExtension.canCopyProperty(taskDefinition, extensionElements);

// then
expect(canCopyProperty).to.be.false;
});

});

});


Expand Down

0 comments on commit 0d1a410

Please sign in to comment.