fix(util): fix isExpanded check

DiUtil/isExpanded now returns either true or false instead of
'undefined' in some cases.

Closes #458
This commit is contained in:
pedesen 2016-01-27 15:11:27 +01:00
parent c3da49b4e5
commit e568312a68
4 changed files with 12 additions and 2 deletions

View File

@ -360,7 +360,7 @@ function canDrop(element, target, position) {
// and participants
if (is(element, 'bpmn:FlowElement') || is(element, 'bpmn:DataAssociation')) {
if (is(target, 'bpmn:FlowElementsContainer')) {
return isExpanded(target) !== false;
return isExpanded(target);
}
return isAny(target, [ 'bpmn:Participant', 'bpmn:Lane' ]);

View File

@ -10,7 +10,7 @@ module.exports.isExpanded = function(element) {
}
if (is(element, 'bpmn:SubProcess')) {
return getBusinessObject(element).di.isExpanded;
return !!getBusinessObject(element).di.isExpanded;
}
if (is(element, 'bpmn:Participant')) {

View File

@ -21,6 +21,7 @@
<bpmn2:dataObjectReference id="DataObjectReference" dataObjectRef="DataObject"/>
<bpmn2:dataObject id="DataObject"/>
<bpmn2:dataStoreReference id="DataStoreReference" name="" dataStoreRef="DataStore_1"/>
<bpmn2:subProcess id="CollapsedSubProcess"/>
<bpmn2:textAnnotation id="TextAnnotation"/>
</bpmn2:process>
<bpmn2:dataStore id="DataStore_1" name="Data Store 1"/>
@ -83,6 +84,9 @@
<dc:Bounds height="21.0" width="79.0" x="657.0" y="216.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="CollapsedSubProcess_di" bpmnElement="CollapsedSubProcess">
<dc:Bounds x="756" y="358" width="100" height="80"/>
</bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn2:definitions>

View File

@ -102,6 +102,12 @@ describe('features/modeling/rules - BpmnRules', function() {
}));
it('drop Start Event -> Collapsed Sub Process', function(){
expectCanDrop('StartEvent_None', 'CollapsedSubProcess', false);
});
it('connect DataObjectReference -> StartEvent_None', inject(function() {
expectCanConnect('DataObjectReference', 'StartEvent_None', {