mirror of
https://github.com/sartography/bpmn-js.git
synced 2025-01-14 02:54:37 +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
28460b1222
commit
88fe4cd840
@ -112,7 +112,8 @@ BpmnFactory.prototype.createDiWaypoint = function(point) {
|
|||||||
|
|
||||||
BpmnFactory.prototype.createDiEdge = function(semantic, waypoints, attrs) {
|
BpmnFactory.prototype.createDiEdge = function(semantic, waypoints, attrs) {
|
||||||
return this.create('bpmndi:BPMNEdge', assign({
|
return this.create('bpmndi:BPMNEdge', assign({
|
||||||
bpmnElement: semantic
|
bpmnElement: semantic,
|
||||||
|
waypoint: this.createDiWaypoints(waypoints)
|
||||||
}, attrs));
|
}, attrs));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -7,6 +7,11 @@ import {
|
|||||||
find
|
find
|
||||||
} from 'min-dash';
|
} from 'min-dash';
|
||||||
|
|
||||||
|
import {
|
||||||
|
is,
|
||||||
|
getBusinessObject
|
||||||
|
} from 'lib/util/ModelUtil';
|
||||||
|
|
||||||
import modelingModule from 'lib/features/modeling';
|
import modelingModule from 'lib/features/modeling';
|
||||||
import coreModule from 'lib/core';
|
import coreModule from 'lib/core';
|
||||||
|
|
||||||
@ -72,26 +77,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);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
});
|
});
|
||||||
@ -333,3 +347,10 @@ describe('features/modeling - append shape', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
// helper ////////////////
|
||||||
|
|
||||||
|
function getDi(element) {
|
||||||
|
return getBusinessObject(element).di;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user