feat(replace): add compensation morph options
* compensation boundary * compensation activity Related to #291
This commit is contained in:
parent
f7a4a21d91
commit
d7834e9bee
|
@ -69,7 +69,7 @@ ElementFactory.prototype.createBpmnElement = function(elementType, attrs) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!!attrs.isExpanded) {
|
if (attrs.isExpanded) {
|
||||||
businessObject.di.isExpanded = attrs.isExpanded;
|
businessObject.di.isExpanded = attrs.isExpanded;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,14 +81,23 @@ ElementFactory.prototype.createBpmnElement = function(elementType, attrs) {
|
||||||
businessObject.isInterrupting = false;
|
businessObject.isInterrupting = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (attrs._eventDefinitionType) {
|
var eventDefinitions,
|
||||||
var eventDefinitions = businessObject.get('eventDefinitions') || [],
|
newEventDefinition;
|
||||||
newEventDefinition = this._moddle.create(attrs._eventDefinitionType);
|
|
||||||
|
if (attrs.eventDefinitionType) {
|
||||||
|
eventDefinitions = businessObject.get('eventDefinitions') || [];
|
||||||
|
newEventDefinition = this._moddle.create(attrs.eventDefinitionType);
|
||||||
|
|
||||||
eventDefinitions.push(newEventDefinition);
|
eventDefinitions.push(newEventDefinition);
|
||||||
|
|
||||||
|
newEventDefinition.$parent = businessObject;
|
||||||
businessObject.eventDefinitions = eventDefinitions;
|
businessObject.eventDefinitions = eventDefinitions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (attrs.isForCompensation) {
|
||||||
|
businessObject.isForCompensation = true;
|
||||||
|
}
|
||||||
|
|
||||||
size = this._getDefaultSize(businessObject);
|
size = this._getDefaultSize(businessObject);
|
||||||
|
|
||||||
attrs = assign({
|
attrs = assign({
|
||||||
|
|
|
@ -188,6 +188,14 @@ ReplaceMenuProvider.prototype.getEntries = function(element) {
|
||||||
if (is(businessObject, 'bpmn:FlowNode')) {
|
if (is(businessObject, 'bpmn:FlowNode')) {
|
||||||
entries = filter(replaceOptions.TASK, differentType);
|
entries = filter(replaceOptions.TASK, differentType);
|
||||||
|
|
||||||
|
if (businessObject.isForCompensation) {
|
||||||
|
|
||||||
|
// can only replace to compensation activities
|
||||||
|
entries = filter(entries, function(entry) {
|
||||||
|
return !/CallActivity|SubProcess/.test(entry.target.type);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return this._createEntries(element, entries);
|
return this._createEntries(element, entries);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,10 +17,10 @@ function isDifferentType(element) {
|
||||||
var target = entry.target;
|
var target = entry.target;
|
||||||
|
|
||||||
var businessObject = getBusinessObject(element),
|
var businessObject = getBusinessObject(element),
|
||||||
eventDefinition = businessObject.eventDefinitions && businessObject.eventDefinitions[0].$type;
|
eventDefinition = businessObject.eventDefinitions && businessObject.eventDefinitions[0];
|
||||||
|
|
||||||
var isEventDefinitionEqual = target.eventDefinition == eventDefinition,
|
var isEventDefinitionEqual = (eventDefinition && eventDefinition.$type) === target.eventDefinitionType,
|
||||||
isTypeEqual = businessObject.$type == target.type,
|
isTypeEqual = businessObject.$type === target.type,
|
||||||
isTriggeredByEventEqual = businessObject.triggeredByEvent == target.triggeredByEvent;
|
isTriggeredByEventEqual = businessObject.triggeredByEvent == target.triggeredByEvent;
|
||||||
|
|
||||||
return !isTypeEqual || !isEventDefinitionEqual || !isTriggeredByEventEqual;
|
return !isTypeEqual || !isEventDefinitionEqual || !isTriggeredByEventEqual;
|
||||||
|
|
|
@ -37,24 +37,20 @@ function BpmnReplace(bpmnFactory, replace, selection, modeling) {
|
||||||
|
|
||||||
var type = target.type,
|
var type = target.type,
|
||||||
oldBusinessObject = element.businessObject,
|
oldBusinessObject = element.businessObject,
|
||||||
businessObject = bpmnFactory.create(type);
|
newBusinessObject = bpmnFactory.create(type);
|
||||||
|
|
||||||
var newElement = {
|
var newElement = {
|
||||||
type: type,
|
type: type,
|
||||||
businessObject: businessObject
|
businessObject: newBusinessObject
|
||||||
};
|
};
|
||||||
|
|
||||||
// initialize custom BPMN extensions
|
// initialize custom BPMN extensions
|
||||||
if (target.eventDefinition) {
|
if (target.eventDefinitionType) {
|
||||||
var eventDefinitions = businessObject.get('eventDefinitions'),
|
newElement.eventDefinitionType = target.eventDefinitionType;
|
||||||
eventDefinition = bpmnFactory.create(target.eventDefinition);
|
|
||||||
|
|
||||||
eventDefinition.$parent = businessObject;
|
|
||||||
eventDefinitions.push(eventDefinition);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// initialize special properties defined in target definition
|
// initialize special properties defined in target definition
|
||||||
assign(businessObject, pick(target, CUSTOM_PROPERTIES));
|
assign(newBusinessObject, pick(target, CUSTOM_PROPERTIES));
|
||||||
|
|
||||||
// copy size (for activities only)
|
// copy size (for activities only)
|
||||||
if (is(oldBusinessObject, 'bpmn:Activity')) {
|
if (is(oldBusinessObject, 'bpmn:Activity')) {
|
||||||
|
@ -69,20 +65,24 @@ function BpmnReplace(bpmnFactory, replace, selection, modeling) {
|
||||||
newElement.isExpanded = isExpanded(oldBusinessObject);
|
newElement.isExpanded = isExpanded(oldBusinessObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
businessObject.name = oldBusinessObject.name;
|
newBusinessObject.name = oldBusinessObject.name;
|
||||||
|
|
||||||
// retain loop characteristics if the target element is not an event sub process
|
// retain loop characteristics if the target element is not an event sub process
|
||||||
if (!isEventSubProcess(businessObject)) {
|
if (!isEventSubProcess(newBusinessObject)) {
|
||||||
businessObject.loopCharacteristics = oldBusinessObject.loopCharacteristics;
|
newBusinessObject.loopCharacteristics = oldBusinessObject.loopCharacteristics;
|
||||||
}
|
}
|
||||||
|
|
||||||
// retain default flow's reference between inclusive <-> exclusive gateways and activities
|
// retain default flow's reference between inclusive <-> exclusive gateways and activities
|
||||||
if ((is(oldBusinessObject, 'bpmn:ExclusiveGateway') || is(oldBusinessObject, 'bpmn:InclusiveGateway') ||
|
if ((is(oldBusinessObject, 'bpmn:ExclusiveGateway') || is(oldBusinessObject, 'bpmn:InclusiveGateway') ||
|
||||||
is(oldBusinessObject, 'bpmn:Activity')) &&
|
is(oldBusinessObject, 'bpmn:Activity')) &&
|
||||||
(is(businessObject, 'bpmn:ExclusiveGateway') || is(businessObject, 'bpmn:InclusiveGateway') ||
|
(is(newBusinessObject, 'bpmn:ExclusiveGateway') || is(newBusinessObject, 'bpmn:InclusiveGateway') ||
|
||||||
is(businessObject, 'bpmn:Activity')))
|
is(newBusinessObject, 'bpmn:Activity')))
|
||||||
{
|
{
|
||||||
businessObject.default = oldBusinessObject.default;
|
newBusinessObject.default = oldBusinessObject.default;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (oldBusinessObject.isForCompensation) {
|
||||||
|
newBusinessObject.isForCompensation = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
newElement = replace.replaceElement(element, newElement);
|
newElement = replace.replaceElement(element, newElement);
|
||||||
|
|
|
@ -31,7 +31,7 @@ module.exports.START_EVENT = [
|
||||||
className: 'bpmn-icon-start-event-message',
|
className: 'bpmn-icon-start-event-message',
|
||||||
target: {
|
target: {
|
||||||
type: 'bpmn:StartEvent',
|
type: 'bpmn:StartEvent',
|
||||||
eventDefinition: 'bpmn:MessageEventDefinition'
|
eventDefinitionType: 'bpmn:MessageEventDefinition'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -40,7 +40,7 @@ module.exports.START_EVENT = [
|
||||||
className: 'bpmn-icon-start-event-timer',
|
className: 'bpmn-icon-start-event-timer',
|
||||||
target: {
|
target: {
|
||||||
type: 'bpmn:StartEvent',
|
type: 'bpmn:StartEvent',
|
||||||
eventDefinition: 'bpmn:TimerEventDefinition'
|
eventDefinitionType: 'bpmn:TimerEventDefinition'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -49,7 +49,7 @@ module.exports.START_EVENT = [
|
||||||
className: 'bpmn-icon-start-event-condition',
|
className: 'bpmn-icon-start-event-condition',
|
||||||
target: {
|
target: {
|
||||||
type: 'bpmn:StartEvent',
|
type: 'bpmn:StartEvent',
|
||||||
eventDefinition: 'bpmn:ConditionalEventDefinition'
|
eventDefinitionType: 'bpmn:ConditionalEventDefinition'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -58,7 +58,7 @@ module.exports.START_EVENT = [
|
||||||
className: 'bpmn-icon-start-event-signal',
|
className: 'bpmn-icon-start-event-signal',
|
||||||
target: {
|
target: {
|
||||||
type: 'bpmn:StartEvent',
|
type: 'bpmn:StartEvent',
|
||||||
eventDefinition: 'bpmn:SignalEventDefinition'
|
eventDefinitionType: 'bpmn:SignalEventDefinition'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
@ -94,7 +94,7 @@ module.exports.INTERMEDIATE_EVENT = [
|
||||||
className: 'bpmn-icon-intermediate-event-catch-message',
|
className: 'bpmn-icon-intermediate-event-catch-message',
|
||||||
target: {
|
target: {
|
||||||
type: 'bpmn:IntermediateCatchEvent',
|
type: 'bpmn:IntermediateCatchEvent',
|
||||||
eventDefinition: 'bpmn:MessageEventDefinition'
|
eventDefinitionType: 'bpmn:MessageEventDefinition'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -103,7 +103,7 @@ module.exports.INTERMEDIATE_EVENT = [
|
||||||
className: 'bpmn-icon-intermediate-event-throw-message',
|
className: 'bpmn-icon-intermediate-event-throw-message',
|
||||||
target: {
|
target: {
|
||||||
type: 'bpmn:IntermediateThrowEvent',
|
type: 'bpmn:IntermediateThrowEvent',
|
||||||
eventDefinition: 'bpmn:MessageEventDefinition'
|
eventDefinitionType: 'bpmn:MessageEventDefinition'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -112,7 +112,7 @@ module.exports.INTERMEDIATE_EVENT = [
|
||||||
className: 'bpmn-icon-intermediate-event-catch-timer',
|
className: 'bpmn-icon-intermediate-event-catch-timer',
|
||||||
target: {
|
target: {
|
||||||
type: 'bpmn:IntermediateCatchEvent',
|
type: 'bpmn:IntermediateCatchEvent',
|
||||||
eventDefinition: 'bpmn:TimerEventDefinition'
|
eventDefinitionType: 'bpmn:TimerEventDefinition'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -121,7 +121,7 @@ module.exports.INTERMEDIATE_EVENT = [
|
||||||
className: 'bpmn-icon-intermediate-event-throw-escalation',
|
className: 'bpmn-icon-intermediate-event-throw-escalation',
|
||||||
target: {
|
target: {
|
||||||
type: 'bpmn:IntermediateThrowEvent',
|
type: 'bpmn:IntermediateThrowEvent',
|
||||||
eventDefinition: 'bpmn:EscalationEventDefinition'
|
eventDefinitionType: 'bpmn:EscalationEventDefinition'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -130,7 +130,7 @@ module.exports.INTERMEDIATE_EVENT = [
|
||||||
className: 'bpmn-icon-intermediate-event-catch-condition',
|
className: 'bpmn-icon-intermediate-event-catch-condition',
|
||||||
target: {
|
target: {
|
||||||
type: 'bpmn:IntermediateCatchEvent',
|
type: 'bpmn:IntermediateCatchEvent',
|
||||||
eventDefinition: 'bpmn:ConditionalEventDefinition'
|
eventDefinitionType: 'bpmn:ConditionalEventDefinition'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -139,7 +139,7 @@ module.exports.INTERMEDIATE_EVENT = [
|
||||||
className: 'bpmn-icon-intermediate-event-catch-link',
|
className: 'bpmn-icon-intermediate-event-catch-link',
|
||||||
target: {
|
target: {
|
||||||
type: 'bpmn:IntermediateCatchEvent',
|
type: 'bpmn:IntermediateCatchEvent',
|
||||||
eventDefinition: 'bpmn:LinkEventDefinition'
|
eventDefinitionType: 'bpmn:LinkEventDefinition'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -148,7 +148,7 @@ module.exports.INTERMEDIATE_EVENT = [
|
||||||
className: 'bpmn-icon-intermediate-event-throw-link',
|
className: 'bpmn-icon-intermediate-event-throw-link',
|
||||||
target: {
|
target: {
|
||||||
type: 'bpmn:IntermediateThrowEvent',
|
type: 'bpmn:IntermediateThrowEvent',
|
||||||
eventDefinition: 'bpmn:LinkEventDefinition'
|
eventDefinitionType: 'bpmn:LinkEventDefinition'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -157,7 +157,7 @@ module.exports.INTERMEDIATE_EVENT = [
|
||||||
className: 'bpmn-icon-intermediate-event-throw-compensation',
|
className: 'bpmn-icon-intermediate-event-throw-compensation',
|
||||||
target: {
|
target: {
|
||||||
type: 'bpmn:IntermediateThrowEvent',
|
type: 'bpmn:IntermediateThrowEvent',
|
||||||
eventDefinition: 'bpmn:CompensateEventDefinition'
|
eventDefinitionType: 'bpmn:CompensateEventDefinition'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -166,7 +166,7 @@ module.exports.INTERMEDIATE_EVENT = [
|
||||||
className: 'bpmn-icon-intermediate-event-catch-signal',
|
className: 'bpmn-icon-intermediate-event-catch-signal',
|
||||||
target: {
|
target: {
|
||||||
type: 'bpmn:IntermediateCatchEvent',
|
type: 'bpmn:IntermediateCatchEvent',
|
||||||
eventDefinition: 'bpmn:SignalEventDefinition'
|
eventDefinitionType: 'bpmn:SignalEventDefinition'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -175,7 +175,7 @@ module.exports.INTERMEDIATE_EVENT = [
|
||||||
className: 'bpmn-icon-intermediate-event-throw-signal',
|
className: 'bpmn-icon-intermediate-event-throw-signal',
|
||||||
target: {
|
target: {
|
||||||
type: 'bpmn:IntermediateThrowEvent',
|
type: 'bpmn:IntermediateThrowEvent',
|
||||||
eventDefinition: 'bpmn:SignalEventDefinition'
|
eventDefinitionType: 'bpmn:SignalEventDefinition'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
@ -211,7 +211,7 @@ module.exports.END_EVENT = [
|
||||||
className: 'bpmn-icon-end-event-message',
|
className: 'bpmn-icon-end-event-message',
|
||||||
target: {
|
target: {
|
||||||
type: 'bpmn:EndEvent',
|
type: 'bpmn:EndEvent',
|
||||||
eventDefinition: 'bpmn:MessageEventDefinition'
|
eventDefinitionType: 'bpmn:MessageEventDefinition'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -220,7 +220,7 @@ module.exports.END_EVENT = [
|
||||||
className: 'bpmn-icon-end-event-escalation',
|
className: 'bpmn-icon-end-event-escalation',
|
||||||
target: {
|
target: {
|
||||||
type: 'bpmn:EndEvent',
|
type: 'bpmn:EndEvent',
|
||||||
eventDefinition: 'bpmn:EscalationEventDefinition'
|
eventDefinitionType: 'bpmn:EscalationEventDefinition'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -229,7 +229,7 @@ module.exports.END_EVENT = [
|
||||||
className: 'bpmn-icon-end-event-error',
|
className: 'bpmn-icon-end-event-error',
|
||||||
target: {
|
target: {
|
||||||
type: 'bpmn:EndEvent',
|
type: 'bpmn:EndEvent',
|
||||||
eventDefinition: 'bpmn:ErrorEventDefinition'
|
eventDefinitionType: 'bpmn:ErrorEventDefinition'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -238,7 +238,7 @@ module.exports.END_EVENT = [
|
||||||
className: 'bpmn-icon-end-event-cancel',
|
className: 'bpmn-icon-end-event-cancel',
|
||||||
target: {
|
target: {
|
||||||
type: 'bpmn:EndEvent',
|
type: 'bpmn:EndEvent',
|
||||||
eventDefinition: 'bpmn:CancelEventDefinition'
|
eventDefinitionType: 'bpmn:CancelEventDefinition'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -247,7 +247,7 @@ module.exports.END_EVENT = [
|
||||||
className: 'bpmn-icon-end-event-compensation',
|
className: 'bpmn-icon-end-event-compensation',
|
||||||
target: {
|
target: {
|
||||||
type: 'bpmn:EndEvent',
|
type: 'bpmn:EndEvent',
|
||||||
eventDefinition: 'bpmn:CompensateEventDefinition'
|
eventDefinitionType: 'bpmn:CompensateEventDefinition'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -256,7 +256,7 @@ module.exports.END_EVENT = [
|
||||||
className: 'bpmn-icon-end-event-signal',
|
className: 'bpmn-icon-end-event-signal',
|
||||||
target: {
|
target: {
|
||||||
type: 'bpmn:EndEvent',
|
type: 'bpmn:EndEvent',
|
||||||
eventDefinition: 'bpmn:SignalEventDefinition'
|
eventDefinitionType: 'bpmn:SignalEventDefinition'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -265,7 +265,7 @@ module.exports.END_EVENT = [
|
||||||
className: 'bpmn-icon-end-event-terminate',
|
className: 'bpmn-icon-end-event-terminate',
|
||||||
target: {
|
target: {
|
||||||
type: 'bpmn:EndEvent',
|
type: 'bpmn:EndEvent',
|
||||||
eventDefinition: 'bpmn:TerminateEventDefinition'
|
eventDefinitionType: 'bpmn:TerminateEventDefinition'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
@ -494,7 +494,7 @@ module.exports.BOUNDARY_EVENT = [
|
||||||
className: 'bpmn-icon-intermediate-event-catch-message',
|
className: 'bpmn-icon-intermediate-event-catch-message',
|
||||||
target: {
|
target: {
|
||||||
type: 'bpmn:BoundaryEvent',
|
type: 'bpmn:BoundaryEvent',
|
||||||
eventDefinition: 'bpmn:MessageEventDefinition'
|
eventDefinitionType: 'bpmn:MessageEventDefinition'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -503,7 +503,7 @@ module.exports.BOUNDARY_EVENT = [
|
||||||
className: 'bpmn-icon-intermediate-event-catch-timer',
|
className: 'bpmn-icon-intermediate-event-catch-timer',
|
||||||
target: {
|
target: {
|
||||||
type: 'bpmn:BoundaryEvent',
|
type: 'bpmn:BoundaryEvent',
|
||||||
eventDefinition: 'bpmn:TimerEventDefinition'
|
eventDefinitionType: 'bpmn:TimerEventDefinition'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -512,7 +512,7 @@ module.exports.BOUNDARY_EVENT = [
|
||||||
className: 'bpmn-icon-intermediate-event-catch-escalation',
|
className: 'bpmn-icon-intermediate-event-catch-escalation',
|
||||||
target: {
|
target: {
|
||||||
type: 'bpmn:BoundaryEvent',
|
type: 'bpmn:BoundaryEvent',
|
||||||
eventDefinition: 'bpmn:EscalationEventDefinition'
|
eventDefinitionType: 'bpmn:EscalationEventDefinition'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -521,7 +521,7 @@ module.exports.BOUNDARY_EVENT = [
|
||||||
className: 'bpmn-icon-intermediate-event-catch-condition',
|
className: 'bpmn-icon-intermediate-event-catch-condition',
|
||||||
target: {
|
target: {
|
||||||
type: 'bpmn:BoundaryEvent',
|
type: 'bpmn:BoundaryEvent',
|
||||||
eventDefinition: 'bpmn:ConditionalEventDefinition'
|
eventDefinitionType: 'bpmn:ConditionalEventDefinition'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -530,7 +530,7 @@ module.exports.BOUNDARY_EVENT = [
|
||||||
className: 'bpmn-icon-intermediate-event-catch-error',
|
className: 'bpmn-icon-intermediate-event-catch-error',
|
||||||
target: {
|
target: {
|
||||||
type: 'bpmn:BoundaryEvent',
|
type: 'bpmn:BoundaryEvent',
|
||||||
eventDefinition: 'bpmn:ErrorEventDefinition'
|
eventDefinitionType: 'bpmn:ErrorEventDefinition'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -539,7 +539,7 @@ module.exports.BOUNDARY_EVENT = [
|
||||||
className: 'bpmn-icon-intermediate-event-catch-cancel',
|
className: 'bpmn-icon-intermediate-event-catch-cancel',
|
||||||
target: {
|
target: {
|
||||||
type: 'bpmn:BoundaryEvent',
|
type: 'bpmn:BoundaryEvent',
|
||||||
eventDefinition: 'bpmn:CancelEventDefinition'
|
eventDefinitionType: 'bpmn:CancelEventDefinition'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -548,7 +548,16 @@ module.exports.BOUNDARY_EVENT = [
|
||||||
className: 'bpmn-icon-intermediate-event-catch-signal',
|
className: 'bpmn-icon-intermediate-event-catch-signal',
|
||||||
target: {
|
target: {
|
||||||
type: 'bpmn:BoundaryEvent',
|
type: 'bpmn:BoundaryEvent',
|
||||||
eventDefinition: 'bpmn:SignalEventDefinition'
|
eventDefinitionType: 'bpmn:SignalEventDefinition'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Compensation Boundary Event',
|
||||||
|
actionName: 'replace-with-compensation-boundary',
|
||||||
|
className: 'bpmn-icon-intermediate-event-catch-compensation',
|
||||||
|
target: {
|
||||||
|
type: 'bpmn:BoundaryEvent',
|
||||||
|
eventDefinitionType: 'bpmn:CompensateEventDefinition'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -557,7 +566,7 @@ module.exports.BOUNDARY_EVENT = [
|
||||||
className: 'bpmn-icon-intermediate-event-catch-non-interrupting-message',
|
className: 'bpmn-icon-intermediate-event-catch-non-interrupting-message',
|
||||||
target: {
|
target: {
|
||||||
type: 'bpmn:BoundaryEvent',
|
type: 'bpmn:BoundaryEvent',
|
||||||
eventDefinition: 'bpmn:MessageEventDefinition',
|
eventDefinitionType: 'bpmn:MessageEventDefinition',
|
||||||
cancelActivity: false
|
cancelActivity: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -567,7 +576,7 @@ module.exports.BOUNDARY_EVENT = [
|
||||||
className: 'bpmn-icon-intermediate-event-catch-non-interrupting-timer',
|
className: 'bpmn-icon-intermediate-event-catch-non-interrupting-timer',
|
||||||
target: {
|
target: {
|
||||||
type: 'bpmn:BoundaryEvent',
|
type: 'bpmn:BoundaryEvent',
|
||||||
eventDefinition: 'bpmn:TimerEventDefinition',
|
eventDefinitionType: 'bpmn:TimerEventDefinition',
|
||||||
cancelActivity: false
|
cancelActivity: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -577,7 +586,7 @@ module.exports.BOUNDARY_EVENT = [
|
||||||
className: 'bpmn-icon-intermediate-event-catch-non-interrupting-escalation',
|
className: 'bpmn-icon-intermediate-event-catch-non-interrupting-escalation',
|
||||||
target: {
|
target: {
|
||||||
type: 'bpmn:BoundaryEvent',
|
type: 'bpmn:BoundaryEvent',
|
||||||
eventDefinition: 'bpmn:EscalationEventDefinition',
|
eventDefinitionType: 'bpmn:EscalationEventDefinition',
|
||||||
cancelActivity: false
|
cancelActivity: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -587,7 +596,7 @@ module.exports.BOUNDARY_EVENT = [
|
||||||
className: 'bpmn-icon-intermediate-event-catch-non-interrupting-condition',
|
className: 'bpmn-icon-intermediate-event-catch-non-interrupting-condition',
|
||||||
target: {
|
target: {
|
||||||
type: 'bpmn:BoundaryEvent',
|
type: 'bpmn:BoundaryEvent',
|
||||||
eventDefinition: 'bpmn:ConditionalEventDefinition',
|
eventDefinitionType: 'bpmn:ConditionalEventDefinition',
|
||||||
cancelActivity: false
|
cancelActivity: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -597,7 +606,7 @@ module.exports.BOUNDARY_EVENT = [
|
||||||
className: 'bpmn-icon-intermediate-event-catch-non-interrupting-signal',
|
className: 'bpmn-icon-intermediate-event-catch-non-interrupting-signal',
|
||||||
target: {
|
target: {
|
||||||
type: 'bpmn:BoundaryEvent',
|
type: 'bpmn:BoundaryEvent',
|
||||||
eventDefinition: 'bpmn:SignalEventDefinition',
|
eventDefinitionType: 'bpmn:SignalEventDefinition',
|
||||||
cancelActivity: false
|
cancelActivity: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -610,7 +619,7 @@ module.exports.EVENT_SUB_PROCESS_START_EVENT = [
|
||||||
className: 'bpmn-icon-start-event-message',
|
className: 'bpmn-icon-start-event-message',
|
||||||
target: {
|
target: {
|
||||||
type: 'bpmn:StartEvent',
|
type: 'bpmn:StartEvent',
|
||||||
eventDefinition: 'bpmn:MessageEventDefinition'
|
eventDefinitionType: 'bpmn:MessageEventDefinition'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -619,7 +628,7 @@ module.exports.EVENT_SUB_PROCESS_START_EVENT = [
|
||||||
className: 'bpmn-icon-start-event-timer',
|
className: 'bpmn-icon-start-event-timer',
|
||||||
target: {
|
target: {
|
||||||
type: 'bpmn:StartEvent',
|
type: 'bpmn:StartEvent',
|
||||||
eventDefinition: 'bpmn:TimerEventDefinition'
|
eventDefinitionType: 'bpmn:TimerEventDefinition'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -628,7 +637,7 @@ module.exports.EVENT_SUB_PROCESS_START_EVENT = [
|
||||||
className: 'bpmn-icon-start-event-condition',
|
className: 'bpmn-icon-start-event-condition',
|
||||||
target: {
|
target: {
|
||||||
type: 'bpmn:StartEvent',
|
type: 'bpmn:StartEvent',
|
||||||
eventDefinition: 'bpmn:ConditionalEventDefinition'
|
eventDefinitionType: 'bpmn:ConditionalEventDefinition'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -637,7 +646,7 @@ module.exports.EVENT_SUB_PROCESS_START_EVENT = [
|
||||||
className: 'bpmn-icon-start-event-signal',
|
className: 'bpmn-icon-start-event-signal',
|
||||||
target: {
|
target: {
|
||||||
type: 'bpmn:StartEvent',
|
type: 'bpmn:StartEvent',
|
||||||
eventDefinition: 'bpmn:SignalEventDefinition'
|
eventDefinitionType: 'bpmn:SignalEventDefinition'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -646,7 +655,7 @@ module.exports.EVENT_SUB_PROCESS_START_EVENT = [
|
||||||
className: 'bpmn-icon-start-event-error',
|
className: 'bpmn-icon-start-event-error',
|
||||||
target: {
|
target: {
|
||||||
type: 'bpmn:StartEvent',
|
type: 'bpmn:StartEvent',
|
||||||
eventDefinition: 'bpmn:ErrorEventDefinition'
|
eventDefinitionType: 'bpmn:ErrorEventDefinition'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -655,7 +664,7 @@ module.exports.EVENT_SUB_PROCESS_START_EVENT = [
|
||||||
className: 'bpmn-icon-start-event-escalation',
|
className: 'bpmn-icon-start-event-escalation',
|
||||||
target: {
|
target: {
|
||||||
type: 'bpmn:StartEvent',
|
type: 'bpmn:StartEvent',
|
||||||
eventDefinition: 'bpmn:EscalationEventDefinition'
|
eventDefinitionType: 'bpmn:EscalationEventDefinition'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -664,7 +673,7 @@ module.exports.EVENT_SUB_PROCESS_START_EVENT = [
|
||||||
className: 'bpmn-icon-start-event-compensation',
|
className: 'bpmn-icon-start-event-compensation',
|
||||||
target: {
|
target: {
|
||||||
type: 'bpmn:StartEvent',
|
type: 'bpmn:StartEvent',
|
||||||
eventDefinition: 'bpmn:CompensateEventDefinition'
|
eventDefinitionType: 'bpmn:CompensateEventDefinition'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -673,7 +682,7 @@ module.exports.EVENT_SUB_PROCESS_START_EVENT = [
|
||||||
className: 'bpmn-icon-start-event-non-interrupting-message',
|
className: 'bpmn-icon-start-event-non-interrupting-message',
|
||||||
target: {
|
target: {
|
||||||
type: 'bpmn:StartEvent',
|
type: 'bpmn:StartEvent',
|
||||||
eventDefinition: 'bpmn:MessageEventDefinition',
|
eventDefinitionType: 'bpmn:MessageEventDefinition',
|
||||||
isInterrupting: false
|
isInterrupting: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -683,7 +692,7 @@ module.exports.EVENT_SUB_PROCESS_START_EVENT = [
|
||||||
className: 'bpmn-icon-start-event-non-interrupting-timer',
|
className: 'bpmn-icon-start-event-non-interrupting-timer',
|
||||||
target: {
|
target: {
|
||||||
type: 'bpmn:StartEvent',
|
type: 'bpmn:StartEvent',
|
||||||
eventDefinition: 'bpmn:TimerEventDefinition',
|
eventDefinitionType: 'bpmn:TimerEventDefinition',
|
||||||
isInterrupting: false
|
isInterrupting: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -693,7 +702,7 @@ module.exports.EVENT_SUB_PROCESS_START_EVENT = [
|
||||||
className: 'bpmn-icon-start-event-non-interrupting-condition',
|
className: 'bpmn-icon-start-event-non-interrupting-condition',
|
||||||
target: {
|
target: {
|
||||||
type: 'bpmn:StartEvent',
|
type: 'bpmn:StartEvent',
|
||||||
eventDefinition: 'bpmn:ConditionalEventDefinition',
|
eventDefinitionType: 'bpmn:ConditionalEventDefinition',
|
||||||
isInterrupting: false
|
isInterrupting: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -703,7 +712,7 @@ module.exports.EVENT_SUB_PROCESS_START_EVENT = [
|
||||||
className: 'bpmn-icon-start-event-non-interrupting-signal',
|
className: 'bpmn-icon-start-event-non-interrupting-signal',
|
||||||
target: {
|
target: {
|
||||||
type: 'bpmn:StartEvent',
|
type: 'bpmn:StartEvent',
|
||||||
eventDefinition: 'bpmn:SignalEventDefinition',
|
eventDefinitionType: 'bpmn:SignalEventDefinition',
|
||||||
isInterrupting: false
|
isInterrupting: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -713,7 +722,7 @@ module.exports.EVENT_SUB_PROCESS_START_EVENT = [
|
||||||
className: 'bpmn-icon-start-event-non-interrupting-escalation',
|
className: 'bpmn-icon-start-event-non-interrupting-escalation',
|
||||||
target: {
|
target: {
|
||||||
type: 'bpmn:StartEvent',
|
type: 'bpmn:StartEvent',
|
||||||
eventDefinition: 'bpmn:EscalationEventDefinition',
|
eventDefinitionType: 'bpmn:EscalationEventDefinition',
|
||||||
isInterrupting: false
|
isInterrupting: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -113,7 +113,7 @@ describe('features/modeling - move start event behavior', function() {
|
||||||
// when
|
// when
|
||||||
bpmnReplace.replaceElement(endEvent, {
|
bpmnReplace.replaceElement(endEvent, {
|
||||||
type: 'bpmn:EndEvent',
|
type: 'bpmn:EndEvent',
|
||||||
eventDefinition: 'bpmn:CancelEventDefinition'
|
eventDefinitionType: 'bpmn:CancelEventDefinition'
|
||||||
});
|
});
|
||||||
|
|
||||||
var subProcess = bpmnReplace.replaceElement(transaction, { type: 'bpmn:SubProcess' });
|
var subProcess = bpmnReplace.replaceElement(transaction, { type: 'bpmn:SubProcess' });
|
||||||
|
@ -122,7 +122,7 @@ describe('features/modeling - move start event behavior', function() {
|
||||||
|
|
||||||
// then
|
// then
|
||||||
expect(subProcess.children).to.have.length(2);
|
expect(subProcess.children).to.have.length(2);
|
||||||
expect(newEndEvent.eventDefinitions).to.not.exist;
|
expect(newEndEvent.eventDefinitionTypes).to.not.exist;
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
||||||
|
@ -135,7 +135,7 @@ describe('features/modeling - move start event behavior', function() {
|
||||||
// when
|
// when
|
||||||
bpmnReplace.replaceElement(endEvent, {
|
bpmnReplace.replaceElement(endEvent, {
|
||||||
type: 'bpmn:EndEvent',
|
type: 'bpmn:EndEvent',
|
||||||
eventDefinition: 'bpmn:CancelEventDefinition'
|
eventDefinitionType: 'bpmn:CancelEventDefinition'
|
||||||
});
|
});
|
||||||
|
|
||||||
bpmnReplace.replaceElement(transaction, { type: 'bpmn:SubProcess' });
|
bpmnReplace.replaceElement(transaction, { type: 'bpmn:SubProcess' });
|
||||||
|
@ -162,7 +162,7 @@ describe('features/modeling - move start event behavior', function() {
|
||||||
// when
|
// when
|
||||||
var cancelEvent = bpmnReplace.replaceElement(endEvent, {
|
var cancelEvent = bpmnReplace.replaceElement(endEvent, {
|
||||||
type: 'bpmn:EndEvent',
|
type: 'bpmn:EndEvent',
|
||||||
eventDefinition: 'bpmn:CancelEventDefinition'
|
eventDefinitionType: 'bpmn:CancelEventDefinition'
|
||||||
});
|
});
|
||||||
|
|
||||||
modeling.moveElements([ cancelEvent ], { x: 0, y: 150 }, process);
|
modeling.moveElements([ cancelEvent ], { x: 0, y: 150 }, process);
|
||||||
|
@ -187,7 +187,7 @@ describe('features/modeling - move start event behavior', function() {
|
||||||
// when
|
// when
|
||||||
var cancelEvent = bpmnReplace.replaceElement(endEvent, {
|
var cancelEvent = bpmnReplace.replaceElement(endEvent, {
|
||||||
type: 'bpmn:EndEvent',
|
type: 'bpmn:EndEvent',
|
||||||
eventDefinition: 'bpmn:CancelEventDefinition'
|
eventDefinitionType: 'bpmn:CancelEventDefinition'
|
||||||
});
|
});
|
||||||
|
|
||||||
modeling.moveElements([ cancelEvent ], { x: 0, y: 150 }, process);
|
modeling.moveElements([ cancelEvent ], { x: 0, y: 150 }, process);
|
||||||
|
@ -216,7 +216,7 @@ describe('features/modeling - move start event behavior', function() {
|
||||||
// when
|
// when
|
||||||
bpmnReplace.replaceElement(boundaryEvent, {
|
bpmnReplace.replaceElement(boundaryEvent, {
|
||||||
type: 'bpmn:BoundaryEvent',
|
type: 'bpmn:BoundaryEvent',
|
||||||
eventDefinition: 'bpmn:CancelEventDefinition'
|
eventDefinitionType: 'bpmn:CancelEventDefinition'
|
||||||
});
|
});
|
||||||
|
|
||||||
var subProcess = bpmnReplace.replaceElement(transaction, { type: 'bpmn:SubProcess' });
|
var subProcess = bpmnReplace.replaceElement(transaction, { type: 'bpmn:SubProcess' });
|
||||||
|
@ -224,7 +224,7 @@ describe('features/modeling - move start event behavior', function() {
|
||||||
var newBoundaryEvent = subProcess.attachers[0].businessObject;
|
var newBoundaryEvent = subProcess.attachers[0].businessObject;
|
||||||
|
|
||||||
// then
|
// then
|
||||||
expect(newBoundaryEvent.eventDefinitions).to.not.exist;
|
expect(newBoundaryEvent.eventDefinitionTypes).to.not.exist;
|
||||||
expect(newBoundaryEvent.attachedToRef).to.equal(subProcess.businessObject);
|
expect(newBoundaryEvent.attachedToRef).to.equal(subProcess.businessObject);
|
||||||
expect(elementRegistry.get('Transaction_1')).to.not.exist;
|
expect(elementRegistry.get('Transaction_1')).to.not.exist;
|
||||||
}));
|
}));
|
||||||
|
@ -239,7 +239,7 @@ describe('features/modeling - move start event behavior', function() {
|
||||||
// when
|
// when
|
||||||
bpmnReplace.replaceElement(boundaryEvent, {
|
bpmnReplace.replaceElement(boundaryEvent, {
|
||||||
type: 'bpmn:BoundaryEvent',
|
type: 'bpmn:BoundaryEvent',
|
||||||
eventDefinition: 'bpmn:CancelEventDefinition'
|
eventDefinitionType: 'bpmn:CancelEventDefinition'
|
||||||
});
|
});
|
||||||
|
|
||||||
bpmnReplace.replaceElement(transaction, { type: 'bpmn:SubProcess' });
|
bpmnReplace.replaceElement(transaction, { type: 'bpmn:SubProcess' });
|
||||||
|
@ -268,7 +268,7 @@ describe('features/modeling - move start event behavior', function() {
|
||||||
// when
|
// when
|
||||||
var newBoundaryEvent = bpmnReplace.replaceElement(boundaryEvent, {
|
var newBoundaryEvent = bpmnReplace.replaceElement(boundaryEvent, {
|
||||||
type: 'bpmn:BoundaryEvent',
|
type: 'bpmn:BoundaryEvent',
|
||||||
eventDefinition: 'bpmn:CancelEventDefinition'
|
eventDefinitionType: 'bpmn:CancelEventDefinition'
|
||||||
});
|
});
|
||||||
|
|
||||||
modeling.moveElements([ newBoundaryEvent ], { x: 500, y: 0 }, subProcess, true);
|
modeling.moveElements([ newBoundaryEvent ], { x: 500, y: 0 }, subProcess, true);
|
||||||
|
@ -298,7 +298,7 @@ describe('features/modeling - move start event behavior', function() {
|
||||||
// when
|
// when
|
||||||
var newBoundaryEvent = bpmnReplace.replaceElement(boundaryEvent, {
|
var newBoundaryEvent = bpmnReplace.replaceElement(boundaryEvent, {
|
||||||
type: 'bpmn:BoundaryEvent',
|
type: 'bpmn:BoundaryEvent',
|
||||||
eventDefinition: 'bpmn:CancelEventDefinition'
|
eventDefinitionType: 'bpmn:CancelEventDefinition'
|
||||||
});
|
});
|
||||||
|
|
||||||
modeling.moveElements([ newBoundaryEvent ], { x: 500, y: 0 }, subProcess, true);
|
modeling.moveElements([ newBoundaryEvent ], { x: 500, y: 0 }, subProcess, true);
|
||||||
|
@ -327,7 +327,7 @@ describe('features/modeling - move start event behavior', function() {
|
||||||
// when
|
// when
|
||||||
var newBoundaryEvent = bpmnReplace.replaceElement(boundaryEvent, {
|
var newBoundaryEvent = bpmnReplace.replaceElement(boundaryEvent, {
|
||||||
type: 'bpmn:BoundaryEvent',
|
type: 'bpmn:BoundaryEvent',
|
||||||
eventDefinition: 'bpmn:CancelEventDefinition'
|
eventDefinitionType: 'bpmn:CancelEventDefinition'
|
||||||
});
|
});
|
||||||
|
|
||||||
move.start(canvasEvent({ x: 0, y: 0 }), newBoundaryEvent);
|
move.start(canvasEvent({ x: 0, y: 0 }), newBoundaryEvent);
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd" id="_bOa6QL90EeWDkOoe0mYe7w" exporter="camunda modeler" exporterVersion="2.6.0" targetNamespace="http://activiti.org/bpmn">
|
||||||
|
<bpmn2:process id="Process_1" isExecutable="false">
|
||||||
|
<bpmn2:task id="Task_1" isForCompensation="true"/>
|
||||||
|
</bpmn2:process>
|
||||||
|
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
|
||||||
|
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1">
|
||||||
|
<bpmndi:BPMNShape id="_BPMNShape_Task_2" bpmnElement="Task_1">
|
||||||
|
<dc:Bounds height="80.0" width="100.0" x="116.0" y="189.0"/>
|
||||||
|
</bpmndi:BPMNShape>
|
||||||
|
</bpmndi:BPMNPlane>
|
||||||
|
</bpmndi:BPMNDiagram>
|
||||||
|
</bpmn2:definitions>
|
|
@ -33,7 +33,7 @@ function queryPopup(popupMenu, selector) {
|
||||||
*
|
*
|
||||||
* @param {PopupMenu} popupMenu
|
* @param {PopupMenu} popupMenu
|
||||||
*
|
*
|
||||||
* @return {<Array>} [description]
|
* @return {<Array>}
|
||||||
*/
|
*/
|
||||||
function getEntries(popupMenu) {
|
function getEntries(popupMenu) {
|
||||||
var element = popupMenu._current.element;
|
var element = popupMenu._current.element;
|
||||||
|
@ -52,7 +52,7 @@ function triggerAction(entries, id) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
describe('features/replace-menu', function() {
|
describe('features/popup-menu - replace menu provider', function() {
|
||||||
|
|
||||||
var diagramXMLMarkers = require('../../../fixtures/bpmn/draw/activity-markers-simple.bpmn'),
|
var diagramXMLMarkers = require('../../../fixtures/bpmn/draw/activity-markers-simple.bpmn'),
|
||||||
diagramXMLReplace = require('../../../fixtures/bpmn/features/replace/01_replace.bpmn');
|
diagramXMLReplace = require('../../../fixtures/bpmn/features/replace/01_replace.bpmn');
|
||||||
|
@ -83,6 +83,15 @@ describe('features/replace-menu', function() {
|
||||||
|
|
||||||
beforeEach(bootstrapModeler(diagramXMLMarkers, { modules: testModules }));
|
beforeEach(bootstrapModeler(diagramXMLMarkers, { modules: testModules }));
|
||||||
|
|
||||||
|
var toggleActive;
|
||||||
|
|
||||||
|
beforeEach(inject(function(popupMenu) {
|
||||||
|
toggleActive = function(entryCls) {
|
||||||
|
return popupMenu._getEntry(entryCls).active;
|
||||||
|
};
|
||||||
|
}));
|
||||||
|
|
||||||
|
|
||||||
describe('active attribute', function(){
|
describe('active attribute', function(){
|
||||||
|
|
||||||
it('should be true for parallel marker', inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
it('should be true for parallel marker', inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
||||||
|
@ -91,16 +100,17 @@ describe('features/replace-menu', function() {
|
||||||
var task = elementRegistry.get('ParallelTask'),
|
var task = elementRegistry.get('ParallelTask'),
|
||||||
loopCharacteristics = task.businessObject.loopCharacteristics;
|
loopCharacteristics = task.businessObject.loopCharacteristics;
|
||||||
|
|
||||||
|
// assume
|
||||||
|
expect(loopCharacteristics.isSequential).to.be.false;
|
||||||
|
expect(loopCharacteristics.isSequential).to.exist;
|
||||||
|
|
||||||
// when
|
// when
|
||||||
openPopup(task);
|
openPopup(task);
|
||||||
|
|
||||||
// then
|
// then
|
||||||
expect(is(loopCharacteristics, 'bpmn:MultiInstanceLoopCharacteristics')).to.be.true;
|
expect(is(loopCharacteristics, 'bpmn:MultiInstanceLoopCharacteristics')).to.be.true;
|
||||||
|
|
||||||
expect(loopCharacteristics.isSequential).to.be.false;
|
expect(toggleActive('toggle-parallel-mi')).to.be.true;
|
||||||
expect(loopCharacteristics.isSequential).to.exist;
|
|
||||||
|
|
||||||
expect(popupMenu._getEntry('toggle-parallel-mi').active).to.be.true;
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
||||||
|
@ -110,13 +120,15 @@ describe('features/replace-menu', function() {
|
||||||
var task = elementRegistry.get('SequentialTask'),
|
var task = elementRegistry.get('SequentialTask'),
|
||||||
loopCharacteristics = task.businessObject.loopCharacteristics;
|
loopCharacteristics = task.businessObject.loopCharacteristics;
|
||||||
|
|
||||||
|
// assume
|
||||||
|
expect(loopCharacteristics.isSequential).to.be.true;
|
||||||
|
expect(is(loopCharacteristics, 'bpmn:MultiInstanceLoopCharacteristics')).to.be.true;
|
||||||
|
|
||||||
// when
|
// when
|
||||||
openPopup(task);
|
openPopup(task);
|
||||||
|
|
||||||
// then
|
// then
|
||||||
expect(loopCharacteristics.isSequential).to.be.true;
|
expect(toggleActive('toggle-sequential-mi')).to.be.true;
|
||||||
expect(popupMenu._getEntry('toggle-sequential-mi').active).to.be.true;
|
|
||||||
expect(is(loopCharacteristics, 'bpmn:MultiInstanceLoopCharacteristics')).to.be.true;
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
||||||
|
@ -126,13 +138,15 @@ describe('features/replace-menu', function() {
|
||||||
var task = elementRegistry.get('LoopTask'),
|
var task = elementRegistry.get('LoopTask'),
|
||||||
loopCharacteristics = task.businessObject.loopCharacteristics;
|
loopCharacteristics = task.businessObject.loopCharacteristics;
|
||||||
|
|
||||||
|
// assume
|
||||||
|
expect(loopCharacteristics.isSequential).not.to.exist;
|
||||||
|
expect(is(loopCharacteristics, 'bpmn:MultiInstanceLoopCharacteristics')).to.be.false;
|
||||||
|
|
||||||
// when
|
// when
|
||||||
openPopup(task);
|
openPopup(task);
|
||||||
|
|
||||||
// then
|
// then
|
||||||
expect(loopCharacteristics.isSequential).not.to.exist;
|
expect(toggleActive('toggle-loop')).to.be.true;
|
||||||
expect(popupMenu._getEntry('toggle-loop').active).to.be.true;
|
|
||||||
expect(is(loopCharacteristics, 'bpmn:MultiInstanceLoopCharacteristics')).to.be.false;
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
||||||
|
@ -145,7 +159,7 @@ describe('features/replace-menu', function() {
|
||||||
openPopup(AdHocSubProcess);
|
openPopup(AdHocSubProcess);
|
||||||
|
|
||||||
// then
|
// then
|
||||||
expect(popupMenu._getEntry('toggle-adhoc').active).to.be.true;
|
expect(toggleActive('toggle-adhoc')).to.be.true;
|
||||||
}));
|
}));
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -173,6 +187,7 @@ describe('features/replace-menu', function() {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
describe('non exclusive toggle buttons', function(){
|
describe('non exclusive toggle buttons', function(){
|
||||||
|
|
||||||
it('should not toggle exclusive buttons off',
|
it('should not toggle exclusive buttons off',
|
||||||
|
@ -641,11 +656,9 @@ describe('features/replace-menu', function() {
|
||||||
// when
|
// when
|
||||||
openPopup(startEvent);
|
openPopup(startEvent);
|
||||||
|
|
||||||
var entriesContainer = queryPopup(popupMenu, '.djs-popup-body');
|
|
||||||
|
|
||||||
// then
|
// then
|
||||||
expect(queryEntry(popupMenu, 'replace-with-none-start')).to.be.null;
|
expect(queryEntry(popupMenu, 'replace-with-none-start')).to.be.null;
|
||||||
expect(entriesContainer.childNodes.length).to.equal(6);
|
expect(getEntries(popupMenu)).to.have.length(6);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
||||||
|
@ -658,12 +671,11 @@ describe('features/replace-menu', function() {
|
||||||
// when
|
// when
|
||||||
openPopup(startEvent);
|
openPopup(startEvent);
|
||||||
|
|
||||||
var entriesContainer = queryPopup(popupMenu, '.djs-popup-body');
|
|
||||||
|
|
||||||
// then
|
// then
|
||||||
expect(queryEntry(popupMenu, 'replace-with-non-interrupting-message-start')).to.be.null;
|
expect(queryEntry(popupMenu, 'replace-with-non-interrupting-message-start')).to.be.null;
|
||||||
expect(queryEntry(popupMenu, 'replace-with-message-start')).to.exist;
|
expect(queryEntry(popupMenu, 'replace-with-message-start')).to.exist;
|
||||||
expect(entriesContainer.childNodes.length).to.equal(11);
|
|
||||||
|
expect(getEntries(popupMenu)).to.have.length(11);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
||||||
|
@ -675,19 +687,18 @@ describe('features/replace-menu', function() {
|
||||||
|
|
||||||
var newElement = bpmnReplace.replaceElement(startEvent, {
|
var newElement = bpmnReplace.replaceElement(startEvent, {
|
||||||
type: 'bpmn:StartEvent',
|
type: 'bpmn:StartEvent',
|
||||||
eventDefinition: 'bpmn:ConditionalEventDefinition',
|
eventDefinitionType: 'bpmn:ConditionalEventDefinition',
|
||||||
isInterrupting: false
|
isInterrupting: false
|
||||||
});
|
});
|
||||||
|
|
||||||
// when
|
// when
|
||||||
openPopup(newElement);
|
openPopup(newElement);
|
||||||
|
|
||||||
var entriesContainer = queryPopup(popupMenu, '.djs-popup-body');
|
|
||||||
|
|
||||||
// then
|
// then
|
||||||
expect(queryEntry(popupMenu, 'replace-with-conditional-start')).to.exist;
|
expect(queryEntry(popupMenu, 'replace-with-conditional-start')).to.exist;
|
||||||
expect(queryEntry(popupMenu, 'replace-with-non-interrupting-conditional-start')).to.be.null;
|
expect(queryEntry(popupMenu, 'replace-with-non-interrupting-conditional-start')).to.be.null;
|
||||||
expect(entriesContainer.childNodes.length).to.equal(11);
|
|
||||||
|
expect(getEntries(popupMenu)).to.have.length(11);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
||||||
|
@ -700,11 +711,10 @@ describe('features/replace-menu', function() {
|
||||||
// when
|
// when
|
||||||
openPopup(intermediateEvent);
|
openPopup(intermediateEvent);
|
||||||
|
|
||||||
var entriesContainer = queryPopup(popupMenu, '.djs-popup-body');
|
|
||||||
|
|
||||||
// then
|
// then
|
||||||
expect(queryEntry(popupMenu, 'replace-with-none-intermediate-throw')).to.be.null;
|
expect(queryEntry(popupMenu, 'replace-with-none-intermediate-throw')).to.be.null;
|
||||||
expect(entriesContainer.childNodes.length).to.equal(12);
|
|
||||||
|
expect(getEntries(popupMenu)).to.have.length(12);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
||||||
|
@ -717,11 +727,10 @@ describe('features/replace-menu', function() {
|
||||||
// when
|
// when
|
||||||
openPopup(endEvent);
|
openPopup(endEvent);
|
||||||
|
|
||||||
var entriesContainer = queryPopup(popupMenu, '.djs-popup-body');
|
|
||||||
|
|
||||||
// then
|
// then
|
||||||
expect(queryEntry(popupMenu, 'replace-with-none-end')).to.be.null;
|
expect(queryEntry(popupMenu, 'replace-with-none-end')).to.be.null;
|
||||||
expect(entriesContainer.childNodes.length).to.equal(8);
|
|
||||||
|
expect(getEntries(popupMenu)).to.have.length(9);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -734,18 +743,16 @@ describe('features/replace-menu', function() {
|
||||||
beforeEach(bootstrapModeler(diagramXML, { modules: testModules }));
|
beforeEach(bootstrapModeler(diagramXML, { modules: testModules }));
|
||||||
|
|
||||||
it('should contain cancel event replace option',
|
it('should contain cancel event replace option',
|
||||||
|
|
||||||
inject(function(elementRegistry, bpmnReplace, popupMenu, replaceMenuProvider) {
|
inject(function(elementRegistry, bpmnReplace, popupMenu, replaceMenuProvider) {
|
||||||
|
|
||||||
// given
|
// given
|
||||||
var endEvent = elementRegistry.get('EndEvent_1');
|
var endEvent = elementRegistry.get('EndEvent_1');
|
||||||
|
|
||||||
// when
|
// when
|
||||||
openPopup(endEvent);
|
openPopup(endEvent);
|
||||||
|
|
||||||
var entries = getEntries(popupMenu);
|
|
||||||
|
|
||||||
// then
|
// then
|
||||||
expect(entries).to.have.length(9);
|
expect(getEntries(popupMenu)).to.have.length(9);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
||||||
|
@ -755,15 +762,11 @@ describe('features/replace-menu', function() {
|
||||||
// given
|
// given
|
||||||
var endEvent = elementRegistry.get('EndEvent_2');
|
var endEvent = elementRegistry.get('EndEvent_2');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// when
|
// when
|
||||||
openPopup(endEvent);
|
openPopup(endEvent);
|
||||||
|
|
||||||
var entries = getEntries(popupMenu);
|
|
||||||
|
|
||||||
// then
|
// then
|
||||||
expect(entries).to.have.length(8);
|
expect(getEntries(popupMenu)).to.have.length(9);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
||||||
|
@ -773,14 +776,11 @@ describe('features/replace-menu', function() {
|
||||||
// given
|
// given
|
||||||
var boundaryEvent = elementRegistry.get('BoundaryEvent_1');
|
var boundaryEvent = elementRegistry.get('BoundaryEvent_1');
|
||||||
|
|
||||||
|
// when
|
||||||
openPopup(boundaryEvent);
|
openPopup(boundaryEvent);
|
||||||
|
|
||||||
// when
|
|
||||||
var entries = getEntries(popupMenu);
|
|
||||||
|
|
||||||
// then
|
// then
|
||||||
expect(entries).to.have.length(12);
|
expect(getEntries(popupMenu)).to.have.length(13);
|
||||||
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
||||||
|
@ -793,11 +793,8 @@ describe('features/replace-menu', function() {
|
||||||
// when
|
// when
|
||||||
openPopup(boundaryEvent, 40);
|
openPopup(boundaryEvent, 40);
|
||||||
|
|
||||||
var entries = getEntries(popupMenu);
|
|
||||||
|
|
||||||
// then
|
// then
|
||||||
expect(entries).to.have.length(11);
|
expect(getEntries(popupMenu)).to.have.length(13);
|
||||||
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -816,11 +813,9 @@ describe('features/replace-menu', function() {
|
||||||
// when
|
// when
|
||||||
openPopup(boundaryEvent, 40);
|
openPopup(boundaryEvent, 40);
|
||||||
|
|
||||||
var entriesContainer = queryPopup(popupMenu, '.djs-popup-body');
|
|
||||||
|
|
||||||
// then
|
// then
|
||||||
expect(queryEntry(popupMenu, 'replace-with-conditional-intermediate-catch')).to.be.null;
|
expect(queryEntry(popupMenu, 'replace-with-conditional-intermediate-catch')).to.be.null;
|
||||||
expect(entriesContainer.childNodes.length).to.equal(10);
|
expect(getEntries(popupMenu)).to.have.length(12);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
||||||
|
@ -833,11 +828,23 @@ describe('features/replace-menu', function() {
|
||||||
// when
|
// when
|
||||||
openPopup(boundaryEvent, 40);
|
openPopup(boundaryEvent, 40);
|
||||||
|
|
||||||
var entriesContainer = queryPopup(popupMenu, '.djs-popup-body');
|
|
||||||
|
|
||||||
// then
|
// then
|
||||||
expect(queryEntry(popupMenu, 'replace-with-non-interrupting-message-intermediate-catch')).to.be.null;
|
expect(queryEntry(popupMenu, 'replace-with-non-interrupting-message-intermediate-catch')).to.be.null;
|
||||||
expect(entriesContainer.childNodes.length).to.equal(10);
|
expect(getEntries(popupMenu)).to.have.length(12);
|
||||||
|
}));
|
||||||
|
|
||||||
|
|
||||||
|
it('should contain compensation boundary event',
|
||||||
|
inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
||||||
|
|
||||||
|
// given
|
||||||
|
var boundaryEvent = elementRegistry.get('BoundaryEvent_1');
|
||||||
|
|
||||||
|
// when
|
||||||
|
openPopup(boundaryEvent, 40);
|
||||||
|
|
||||||
|
// then
|
||||||
|
expect(queryEntry(popupMenu, 'replace-with-compensation-boundary')).to.exist;
|
||||||
}));
|
}));
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -856,10 +863,8 @@ describe('features/replace-menu', function() {
|
||||||
// when
|
// when
|
||||||
openPopup(sequenceFlow);
|
openPopup(sequenceFlow);
|
||||||
|
|
||||||
var entriesContainer = queryPopup(popupMenu, '.djs-popup-body');
|
|
||||||
|
|
||||||
// then
|
// then
|
||||||
expect(entriesContainer.childNodes.length).to.equal(1);
|
expect(getEntries(popupMenu)).to.have.length(1);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
||||||
|
@ -870,10 +875,8 @@ describe('features/replace-menu', function() {
|
||||||
// when
|
// when
|
||||||
openPopup(sequenceFlow);
|
openPopup(sequenceFlow);
|
||||||
|
|
||||||
var entriesContainer = queryPopup(popupMenu, '.djs-popup-body');
|
|
||||||
|
|
||||||
// then
|
// then
|
||||||
expect(entriesContainer.childNodes).to.have.length(2);
|
expect(getEntries(popupMenu)).to.have.length(2);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
||||||
|
@ -884,10 +887,8 @@ describe('features/replace-menu', function() {
|
||||||
// when
|
// when
|
||||||
openPopup(sequenceFlow);
|
openPopup(sequenceFlow);
|
||||||
|
|
||||||
var entriesContainer = queryPopup(popupMenu, '.djs-popup-body');
|
|
||||||
|
|
||||||
// then
|
// then
|
||||||
expect(entriesContainer.childNodes.length).to.equal(0);
|
expect(getEntries(popupMenu)).to.have.length(0);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -946,13 +947,12 @@ describe('features/replace-menu', function() {
|
||||||
// when
|
// when
|
||||||
openPopup(sequenceFlow);
|
openPopup(sequenceFlow);
|
||||||
|
|
||||||
var entriesContainer = queryPopup(popupMenu, '.djs-popup-body'),
|
var conditionalFlowEntry = queryEntry(popupMenu, 'replace-with-conditional-flow');
|
||||||
conditionalFlowEntry = queryEntry(popupMenu, 'replace-with-conditional-flow');
|
|
||||||
|
|
||||||
// then
|
// then
|
||||||
expect(conditionalFlowEntry).to.exist;
|
expect(conditionalFlowEntry).to.exist;
|
||||||
|
|
||||||
expect(entriesContainer.childNodes).to.have.length(2);
|
expect(getEntries(popupMenu)).to.have.length(2);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
||||||
|
@ -963,10 +963,34 @@ describe('features/replace-menu', function() {
|
||||||
// when
|
// when
|
||||||
openPopup(sequenceFlow);
|
openPopup(sequenceFlow);
|
||||||
|
|
||||||
var entriesContainer = queryPopup(popupMenu, '.djs-popup-body');
|
// then
|
||||||
|
expect(getEntries(popupMenu)).to.have.length(0);
|
||||||
|
}));
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
describe('compensate activities', function() {
|
||||||
|
|
||||||
|
var diagramXML = require('./ReplaceMenuProvider.compensation-activity.bpmn');
|
||||||
|
|
||||||
|
beforeEach(bootstrapModeler(diagramXML, { modules: testModules }));
|
||||||
|
|
||||||
|
|
||||||
|
it('should exclude non-activities from options', inject(function(elementRegistry, popupMenu) {
|
||||||
|
|
||||||
|
// given
|
||||||
|
var taskElement = elementRegistry.get('Task_1');
|
||||||
|
|
||||||
|
// when
|
||||||
|
openPopup(taskElement);
|
||||||
|
|
||||||
|
var callActivityEntry = queryEntry(popupMenu, 'replace-with-call-activity'),
|
||||||
|
subProcessEntry = queryEntry(popupMenu, 'replace-with-collapsed-subprocess');
|
||||||
|
|
||||||
// then
|
// then
|
||||||
expect(entriesContainer.childNodes.length).to.equal(0);
|
expect(callActivityEntry).to.not.exist;
|
||||||
|
expect(subProcessEntry).to.not.exist;
|
||||||
}));
|
}));
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -147,7 +147,7 @@ describe('features/replace-preview', function() {
|
||||||
var startEventGfx = getGfx({
|
var startEventGfx = getGfx({
|
||||||
type: 'bpmn:StartEvent',
|
type: 'bpmn:StartEvent',
|
||||||
isInterrupting: false,
|
isInterrupting: false,
|
||||||
_eventDefinitionType: 'bpmn:MessageEventDefinition'
|
eventDefinitionType: 'bpmn:MessageEventDefinition'
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(context.dragGroup[0].innerSVG()).to.equal(startEventGfx.innerSVG());
|
expect(context.dragGroup[0].innerSVG()).to.equal(startEventGfx.innerSVG());
|
||||||
|
@ -188,7 +188,7 @@ describe('features/replace-preview', function() {
|
||||||
var startEventGfx = getGfx({
|
var startEventGfx = getGfx({
|
||||||
type: 'bpmn:StartEvent',
|
type: 'bpmn:StartEvent',
|
||||||
isInterrupting: false,
|
isInterrupting: false,
|
||||||
_eventDefinitionType: 'bpmn:MessageEventDefinition'
|
eventDefinitionType: 'bpmn:MessageEventDefinition'
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(context.dragGroup[0].innerSVG()).to.equal(startEventGfx.innerSVG());
|
expect(context.dragGroup[0].innerSVG()).to.equal(startEventGfx.innerSVG());
|
||||||
|
@ -252,13 +252,13 @@ describe('features/replace-preview', function() {
|
||||||
var messageStartEventGfx = getGfx({
|
var messageStartEventGfx = getGfx({
|
||||||
type: 'bpmn:StartEvent',
|
type: 'bpmn:StartEvent',
|
||||||
isInterrupting: false,
|
isInterrupting: false,
|
||||||
_eventDefinitionType: 'bpmn:MessageEventDefinition'
|
eventDefinitionType: 'bpmn:MessageEventDefinition'
|
||||||
});
|
});
|
||||||
|
|
||||||
var timerStartEventGfx = getGfx({
|
var timerStartEventGfx = getGfx({
|
||||||
type: 'bpmn:StartEvent',
|
type: 'bpmn:StartEvent',
|
||||||
isInterrupting: false,
|
isInterrupting: false,
|
||||||
_eventDefinitionType: 'bpmn:TimerEventDefinition'
|
eventDefinitionType: 'bpmn:TimerEventDefinition'
|
||||||
});
|
});
|
||||||
|
|
||||||
var startEventGfx = getGfx({ type: 'bpmn:StartEvent' });
|
var startEventGfx = getGfx({ type: 'bpmn:StartEvent' });
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd" id="_bOa6QL90EeWDkOoe0mYe7w" exporter="camunda modeler" exporterVersion="2.6.0" targetNamespace="http://activiti.org/bpmn">
|
||||||
|
<bpmn2:process id="Process_1" isExecutable="false">
|
||||||
|
<bpmn2:task id="Task_1" isForCompensation="true"/>
|
||||||
|
</bpmn2:process>
|
||||||
|
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
|
||||||
|
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1">
|
||||||
|
<bpmndi:BPMNShape id="_BPMNShape_Task_2" bpmnElement="Task_1">
|
||||||
|
<dc:Bounds height="80.0" width="100.0" x="116.0" y="189.0"/>
|
||||||
|
</bpmndi:BPMNShape>
|
||||||
|
</bpmndi:BPMNPlane>
|
||||||
|
</bpmndi:BPMNDiagram>
|
||||||
|
</bpmn2:definitions>
|
|
@ -15,7 +15,7 @@ var is = require('../../../../lib/util/ModelUtil').is,
|
||||||
isEventSubProcess = require('../../../../lib/util/DiUtil').isEventSubProcess;
|
isEventSubProcess = require('../../../../lib/util/DiUtil').isEventSubProcess;
|
||||||
|
|
||||||
|
|
||||||
describe('features/replace', function() {
|
describe('features/replace - bpmn replace', function() {
|
||||||
|
|
||||||
var testModules = [ coreModule, modelingModule, replaceModule, moveModule ];
|
var testModules = [ coreModule, modelingModule, replaceModule, moveModule ];
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ describe('features/replace', function() {
|
||||||
var boundaryEvent = elementRegistry.get('BoundaryEvent_1'),
|
var boundaryEvent = elementRegistry.get('BoundaryEvent_1'),
|
||||||
newElementData = {
|
newElementData = {
|
||||||
type: 'bpmn:BoundaryEvent',
|
type: 'bpmn:BoundaryEvent',
|
||||||
eventDefinition: 'bpmn:EscalationEventDefinition'
|
eventDefinitionType: 'bpmn:EscalationEventDefinition'
|
||||||
};
|
};
|
||||||
|
|
||||||
// when
|
// when
|
||||||
|
@ -150,7 +150,7 @@ describe('features/replace', function() {
|
||||||
var boundaryEvent = elementRegistry.get('BoundaryEvent_2'),
|
var boundaryEvent = elementRegistry.get('BoundaryEvent_2'),
|
||||||
newElementData = {
|
newElementData = {
|
||||||
type: 'bpmn:BoundaryEvent',
|
type: 'bpmn:BoundaryEvent',
|
||||||
eventDefinition: 'bpmn:SignalEventDefinition',
|
eventDefinitionType: 'bpmn:SignalEventDefinition',
|
||||||
cancelActivity: false
|
cancelActivity: false
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -159,7 +159,7 @@ describe('features/replace', function() {
|
||||||
|
|
||||||
// then
|
// then
|
||||||
expect(newElement).to.exist;
|
expect(newElement).to.exist;
|
||||||
expect(is(newElement.businessObject, 'bpmn:BoundaryEvent')).to.be.true;
|
expect(is(newElement, 'bpmn:BoundaryEvent')).to.be.true;
|
||||||
expect(newElement.businessObject.eventDefinitions[0].$type).to.equal('bpmn:SignalEventDefinition');
|
expect(newElement.businessObject.eventDefinitions[0].$type).to.equal('bpmn:SignalEventDefinition');
|
||||||
expect(newElement.businessObject.cancelActivity).to.be.false;
|
expect(newElement.businessObject.cancelActivity).to.be.false;
|
||||||
}));
|
}));
|
||||||
|
@ -173,7 +173,7 @@ describe('features/replace', function() {
|
||||||
host = elementRegistry.get('Task_1'),
|
host = elementRegistry.get('Task_1'),
|
||||||
newElementData = {
|
newElementData = {
|
||||||
type: 'bpmn:BoundaryEvent',
|
type: 'bpmn:BoundaryEvent',
|
||||||
eventDefinition: 'bpmn:ErrorEventDefinition',
|
eventDefinitionType: 'bpmn:ErrorEventDefinition',
|
||||||
};
|
};
|
||||||
|
|
||||||
// when
|
// when
|
||||||
|
@ -717,6 +717,31 @@ describe('features/replace', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
describe('compensation activity', function() {
|
||||||
|
|
||||||
|
var diagramXML = require('./BpmnReplace.compensation.bpmn');
|
||||||
|
|
||||||
|
beforeEach(bootstrapModeler(diagramXML, { modules: testModules }));
|
||||||
|
|
||||||
|
|
||||||
|
it('should keep isForCompensation attr', inject(function(elementRegistry, bpmnReplace) {
|
||||||
|
|
||||||
|
// given
|
||||||
|
var task = elementRegistry.get('Task_1');
|
||||||
|
var newElementData = {
|
||||||
|
type: 'bpmn:ServiceTask'
|
||||||
|
};
|
||||||
|
|
||||||
|
// when
|
||||||
|
var newElement = bpmnReplace.replaceElement(task, newElementData);
|
||||||
|
|
||||||
|
// then
|
||||||
|
expect(newElement.businessObject.isForCompensation).to.be.true;
|
||||||
|
}));
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
describe('event sub processes', function() {
|
describe('event sub processes', function() {
|
||||||
|
|
||||||
var diagramXML = require('./BpmnReplace.eventSubProcesses.bpmn');
|
var diagramXML = require('./BpmnReplace.eventSubProcesses.bpmn');
|
||||||
|
@ -892,7 +917,7 @@ describe('features/replace', function() {
|
||||||
|
|
||||||
var messageEvent = bpmnReplace.replaceElement(startEvent, {
|
var messageEvent = bpmnReplace.replaceElement(startEvent, {
|
||||||
type: 'bpmn:StartEvent',
|
type: 'bpmn:StartEvent',
|
||||||
eventDefinition: 'bpmn:MessageEventDefinition'
|
eventDefinitionType: 'bpmn:MessageEventDefinition'
|
||||||
});
|
});
|
||||||
|
|
||||||
var parent = messageEvent.businessObject.eventDefinitions[0].$parent;
|
var parent = messageEvent.businessObject.eventDefinitions[0].$parent;
|
||||||
|
|
|
@ -10,7 +10,7 @@ var modelingModule = require('../../../../lib/features/modeling'),
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
describe('features/replace', function() {
|
describe('features/replace - rules', function() {
|
||||||
|
|
||||||
var diagramXML = require('../../../fixtures/bpmn/features/replace/association-gateways.bpmn');
|
var diagramXML = require('../../../fixtures/bpmn/features/replace/association-gateways.bpmn');
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue