fix(elementFactory): ensure `collapsed` is set
This commit is contained in:
parent
83ffdff08f
commit
eed6c3b662
|
@ -117,6 +117,10 @@ ElementFactory.prototype.createBpmnElement = function(elementType, attrs) {
|
|||
applyAttribute(di, attrs, 'isExpanded');
|
||||
}
|
||||
|
||||
if (is(businessObject, 'bpmn:SubProcess')) {
|
||||
attrs.collapsed = !isExpanded(businessObject, di);
|
||||
}
|
||||
|
||||
if (is(businessObject, 'bpmn:ExclusiveGateway')) {
|
||||
di.isMarkerVisible = true;
|
||||
}
|
||||
|
|
|
@ -116,6 +116,19 @@ describe('features - element factory', function() {
|
|||
}));
|
||||
|
||||
|
||||
it('should add collapsed attribute to subprocess', inject(function(elementFactory) {
|
||||
|
||||
// when
|
||||
var subprocess = elementFactory.createShape({
|
||||
type: 'bpmn:SubProcess',
|
||||
isExpanded: false
|
||||
});
|
||||
|
||||
// then
|
||||
expect(subprocess.collapsed).to.be.true;
|
||||
}));
|
||||
|
||||
|
||||
describe('integration', function() {
|
||||
|
||||
it('should create event definition with ID', inject(function(elementFactory) {
|
||||
|
|
|
@ -1027,6 +1027,30 @@ describe('features/replace - bpmn replace', function() {
|
|||
);
|
||||
|
||||
|
||||
it('should allow expanding newly created subprocess',
|
||||
inject(function(bpmnReplace, elementFactory) {
|
||||
|
||||
// given
|
||||
var collapsedProcess = elementFactory.createShape({
|
||||
type: 'bpmn:SubProcess',
|
||||
isExpanded: false
|
||||
});
|
||||
|
||||
var newElementData = {
|
||||
type: 'bpmn:SubProcess',
|
||||
isExpanded: true
|
||||
};
|
||||
|
||||
// when
|
||||
var newElement = bpmnReplace.replaceElement(collapsedProcess, newElementData);
|
||||
|
||||
// then
|
||||
expect(is(newElement, 'bpmn:SubProcess')).to.be.true;
|
||||
expect(isExpanded(newElement)).to.be.true;
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should keep size when morphing ad hoc',
|
||||
inject(function(bpmnReplace, elementRegistry, modeling) {
|
||||
|
||||
|
|
Loading…
Reference in New Issue