Merge branch 'master' into develop
This commit is contained in:
commit
4ca0a6c9fb
|
@ -768,7 +768,7 @@ function canCreate(shape, target, source, position) {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (isLabel(target) || isGroup(target)) {
|
||||
if (isLabel(shape) || isGroup(shape)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,8 @@ import {
|
|||
expectCanConnect,
|
||||
expectCanDrop,
|
||||
expectCanMove,
|
||||
expectCanInsert
|
||||
expectCanInsert,
|
||||
expectCanCreate
|
||||
} from './Helper';
|
||||
|
||||
import modelingModule from 'lib/features/modeling';
|
||||
|
@ -1055,6 +1056,111 @@ describe('features/modeling/rules - BpmnRules', function() {
|
|||
|
||||
});
|
||||
|
||||
|
||||
describe('create Group', function() {
|
||||
|
||||
var group;
|
||||
|
||||
beforeEach(inject(function(elementFactory) {
|
||||
group = elementFactory.createShape({
|
||||
type: 'bpmn:Group',
|
||||
x: 413, y: 254
|
||||
});
|
||||
}));
|
||||
|
||||
|
||||
it('-> MessageFlow', function() {
|
||||
expectCanCreate(group, 'MessageFlow_labeled', true);
|
||||
});
|
||||
|
||||
|
||||
it('-> CollapsedParticipant', function() {
|
||||
expectCanCreate(group, 'CollapsedParticipant', true);
|
||||
});
|
||||
|
||||
|
||||
it('-> Collaboration', function() {
|
||||
// then
|
||||
expectCanCreate(group, 'Collaboration', true);
|
||||
});
|
||||
|
||||
|
||||
it('-> Task_in_SubProcess', function() {
|
||||
expectCanCreate(group, 'Task_in_SubProcess', true);
|
||||
});
|
||||
|
||||
|
||||
it('-> SequenceFlow', function() {
|
||||
expectCanCreate(group, 'SequenceFlow', true);
|
||||
});
|
||||
|
||||
|
||||
it('-> DataOutputAssociation', function() {
|
||||
expectCanCreate(group, 'DataOutputAssociation', true);
|
||||
});
|
||||
|
||||
|
||||
it('-> Group', function() {
|
||||
expectCanCreate(group, 'Group', true);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
describe('reject create on Group', function() {
|
||||
|
||||
it('DataStoreReference ->', inject(function(elementFactory) {
|
||||
var dataStoreReference = elementFactory.createShape({
|
||||
type: 'bpmn:DataStoreReference',
|
||||
x: 413, y: 254
|
||||
});
|
||||
|
||||
expectCanCreate(dataStoreReference, 'Group', false);
|
||||
}));
|
||||
|
||||
|
||||
it('Task ->', inject(function(elementFactory) {
|
||||
var task = elementFactory.createShape({
|
||||
type: 'bpmn:Task',
|
||||
x: 413, y: 254
|
||||
});
|
||||
|
||||
expectCanCreate(task, 'Group', false);
|
||||
}));
|
||||
|
||||
});
|
||||
|
||||
|
||||
describe('reject create on label', function() {
|
||||
|
||||
var label;
|
||||
|
||||
beforeEach(inject(function(elementRegistry) {
|
||||
label = elementRegistry.get('MessageFlow_labeled').label;
|
||||
}));
|
||||
|
||||
|
||||
it('DataStoreReference ->', inject(function(elementFactory) {
|
||||
var dataStoreReference = elementFactory.createShape({
|
||||
type: 'bpmn:DataStoreReference',
|
||||
x: 413, y: 254
|
||||
});
|
||||
|
||||
expectCanCreate(dataStoreReference, label, false);
|
||||
}));
|
||||
|
||||
|
||||
it('Task ->', inject(function(elementFactory) {
|
||||
var task = elementFactory.createShape({
|
||||
type: 'bpmn:Task',
|
||||
x: 413, y: 254
|
||||
});
|
||||
|
||||
expectCanCreate(task, label, false);
|
||||
}));
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
|
|
@ -47,6 +47,16 @@ export function expectCanDrop(element, target, expectedResult) {
|
|||
}
|
||||
|
||||
|
||||
export function expectCanCreate(element, target, expectedResult) {
|
||||
|
||||
var result = getBpmnJS().invoke(function(bpmnRules) {
|
||||
return bpmnRules.canCreate(get(element), get(target));
|
||||
});
|
||||
|
||||
expect(result).to.eql(expectedResult);
|
||||
}
|
||||
|
||||
|
||||
export function expectCanInsert(element, target, expectedResult) {
|
||||
|
||||
var result = getBpmnJS().invoke(function(bpmnRules) {
|
||||
|
|
Loading…
Reference in New Issue