fix: don't create illegal `waypoint` property
Closes https://github.com/bpmn-io/bpmn-js/issues/1544
This commit is contained in:
parent
4204c2bb2a
commit
88a484e41e
|
@ -112,7 +112,7 @@ BpmnFactory.prototype.createDiWaypoint = function(point) {
|
|||
BpmnFactory.prototype.createDiEdge = function(semantic, attrs) {
|
||||
return this.create('bpmndi:BPMNEdge', assign({
|
||||
bpmnElement: semantic,
|
||||
waypoints: this.createDiWaypoints([])
|
||||
waypoint: this.createDiWaypoints([])
|
||||
}, attrs));
|
||||
};
|
||||
|
||||
|
|
|
@ -8,7 +8,9 @@ import {
|
|||
} from 'min-dash';
|
||||
|
||||
import {
|
||||
getDi
|
||||
getDi,
|
||||
is,
|
||||
getBusinessObject
|
||||
} from 'lib/util/ModelUtil';
|
||||
|
||||
import modelingModule from 'lib/features/modeling';
|
||||
|
@ -76,26 +78,35 @@ describe('features/modeling - append shape', function() {
|
|||
}));
|
||||
|
||||
|
||||
it('should add connection', inject(function(elementRegistry, modeling) {
|
||||
it('should add connection + DI', inject(function(elementRegistry, modeling) {
|
||||
|
||||
// given
|
||||
var startEventShape = elementRegistry.get('StartEvent_1');
|
||||
var subProcessShape = elementRegistry.get('SubProcess_1');
|
||||
|
||||
var startEvent = startEventShape.businessObject,
|
||||
subProcess = subProcessShape.businessObject;
|
||||
var startEventBo = startEventShape.businessObject,
|
||||
subProcessBo = subProcessShape.businessObject;
|
||||
|
||||
// when
|
||||
var targetShape = modeling.appendShape(startEventShape, { type: 'bpmn:Task' }),
|
||||
target = targetShape.businessObject;
|
||||
targetBo = targetShape.businessObject;
|
||||
|
||||
var connection = find(subProcess.get('flowElements'), function(e) {
|
||||
return e.sourceRef === startEvent && e.targetRef === target;
|
||||
});
|
||||
var connection = targetShape.incoming[0],
|
||||
connectionDi = getDi(connection),
|
||||
connectionBo = getBusinessObject(connection);
|
||||
|
||||
// then
|
||||
expect(connection).to.exist;
|
||||
expect(connection.$instanceOf('bpmn:SequenceFlow')).to.be.true;
|
||||
expect(is(connection, 'bpmn:SequenceFlow')).to.be.true;
|
||||
|
||||
expect(connectionBo.sourceRef).to.eql(startEventBo);
|
||||
expect(connectionBo.targetRef).to.eql(targetBo);
|
||||
expect(connectionBo.$parent).to.equal(subProcessBo);
|
||||
|
||||
// https://github.com/bpmn-io/bpmn-js/issues/1544
|
||||
expect(connectionDi.waypoints).not.to.exist;
|
||||
|
||||
expect(connectionDi.waypoint).to.have.length(2);
|
||||
}));
|
||||
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue