mirror of
https://github.com/sartography/bpmn-js.git
synced 2025-02-18 11:56:30 +00:00
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) {
|
BpmnFactory.prototype.createDiEdge = function(semantic, attrs) {
|
||||||
return this.create('bpmndi:BPMNEdge', assign({
|
return this.create('bpmndi:BPMNEdge', assign({
|
||||||
bpmnElement: semantic,
|
bpmnElement: semantic,
|
||||||
waypoints: this.createDiWaypoints([])
|
waypoint: this.createDiWaypoints([])
|
||||||
}, attrs));
|
}, attrs));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -8,7 +8,9 @@ import {
|
|||||||
} from 'min-dash';
|
} from 'min-dash';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
getDi
|
getDi,
|
||||||
|
is,
|
||||||
|
getBusinessObject
|
||||||
} from 'lib/util/ModelUtil';
|
} from 'lib/util/ModelUtil';
|
||||||
|
|
||||||
import modelingModule from 'lib/features/modeling';
|
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
|
// given
|
||||||
var startEventShape = elementRegistry.get('StartEvent_1');
|
var startEventShape = elementRegistry.get('StartEvent_1');
|
||||||
var subProcessShape = elementRegistry.get('SubProcess_1');
|
var subProcessShape = elementRegistry.get('SubProcess_1');
|
||||||
|
|
||||||
var startEvent = startEventShape.businessObject,
|
var startEventBo = startEventShape.businessObject,
|
||||||
subProcess = subProcessShape.businessObject;
|
subProcessBo = subProcessShape.businessObject;
|
||||||
|
|
||||||
// when
|
// when
|
||||||
var targetShape = modeling.appendShape(startEventShape, { type: 'bpmn:Task' }),
|
var targetShape = modeling.appendShape(startEventShape, { type: 'bpmn:Task' }),
|
||||||
target = targetShape.businessObject;
|
targetBo = targetShape.businessObject;
|
||||||
|
|
||||||
var connection = find(subProcess.get('flowElements'), function(e) {
|
var connection = targetShape.incoming[0],
|
||||||
return e.sourceRef === startEvent && e.targetRef === target;
|
connectionDi = getDi(connection),
|
||||||
});
|
connectionBo = getBusinessObject(connection);
|
||||||
|
|
||||||
// then
|
// then
|
||||||
expect(connection).to.exist;
|
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…
x
Reference in New Issue
Block a user