Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it('should remove the documentation for an element', inject(function(propertiesPanel, selection, elementRegistry) {
var shape = elementRegistry.get('ServiceTask_1');
selection.select(shape);
var textField = domQuery('div[name=documentation]', propertiesPanel._container);
var businessObject = getBusinessObject(shape);
// given
expect(textField.textContent).to.equal('Task');
// when
TestHelper.triggerValue(textField, '', 'change');
// then
expect(textField.textContent).to.equal('');
expect(businessObject.get('documentation').length).to.equal(0);
}));
});
it('should get the id of the participant', inject(function(propertiesPanel, selection, elementRegistry) {
// given
var shape = elementRegistry.get('_Participant_2');
var participant = getBusinessObject(shape);
// when
selection.select(shape);
// then
var input = domQuery('div[data-entry=id] input[name=id]', propertiesPanel._container);
expect(input.value).to.equal(participant.get('id'));
}));
it('should migrate camunda:async to asyncBefore when asyncBefore is toggled', inject(function(propertiesPanel, selection, elementRegistry) {
// given
var shape = elementRegistry.get('ServiceTask');
selection.select(shape);
var asyncBeforeField = getAsyncBefore(propertiesPanel._container);
// when
TestHelper.triggerEvent(asyncBeforeField, 'click');
// then
var bo = getBusinessObject(shape);
expect(bo.get('camunda:async')).to.be.not.ok;
}));
it('should get the id of the participant', inject(function(propertiesPanel, selection, elementRegistry) {
// given
var shape = elementRegistry.get('_Participant_2');
var participant = getBusinessObject(shape);
// when
selection.select(shape);
// then
var input = domQuery('div[data-entry=id] input[name=id]', propertiesPanel._container);
expect(input.value).to.equal(participant.get('id'));
}));
beforeEach(inject(function(elementRegistry, selection) {
const shape = elementRegistry.get('Task_1');
selection.select(shape);
bo = getBusinessObject(shape);
// assume
expect(getTaskHeaders(bo)).to.be.undefined;
// when
clickAddHeaderButton(container);
}));
bpmnModeler.on('element.contextmenu', HIGH_PRIORITY, (event) => {
event.originalEvent.preventDefault();
event.originalEvent.stopPropagation();
qualityAssuranceEl.classList.remove('hidden');
({ element } = event);
// ignore root element
if (!element.parent) {
return;
}
businessObject = getBusinessObject(element);
let { suitable } = businessObject;
suitabilityScoreEl.value = suitable ? suitable : '';
suitabilityScoreEl.focus();
analysisDetails = getExtensionElement(businessObject, 'qa:AnalysisDetails');
lastCheckedEl.textContent = analysisDetails ? analysisDetails.lastChecked : '-';
validate();
});
it('should fetch the inline script properties of an execution listener', inject(function(propertiesPanel, selection, elementRegistry) {
var shape = elementRegistry.get('StartEvent_1');
selection.select(shape);
var eventType = domQuery('div[data-entry=listener-event-type] select[name=eventType]', propertiesPanel._container),
listenerType = domQuery('div[data-entry=listener-type] select[name=listenerType]', propertiesPanel._container),
scriptFormat = domQuery('div[data-entry=listener-script-value] input[name=scriptFormat]', propertiesPanel._container),
scriptType = domQuery('div[data-entry=listener-script-value] select[name="scriptType"]', propertiesPanel._container),
scriptValue = domQuery('div[data-entry=listener-script-value] textarea[name="scriptValue"]', propertiesPanel._container),
businessObject = getBusinessObject(shape).extensionElements.values;
selectListener(propertiesPanel._container, 0, 'executionListeners');
expect(eventType.value).to.equal('start');
expect(listenerType.value).to.equal('script');
expect(scriptFormat.value).to.equal('groovy');
expect(scriptType.value).to.equal('script');
expect(scriptValue.value).to.equal('${sourceCode}');
expect(businessObject.length).to.equal(1);
expect(businessObject[0].get('event')).to.equal(eventType.value);
expect(businessObject[0].script.get('scriptFormat')).to.equal(scriptFormat.value);
expect(businessObject[0].script.value).to.equal(scriptValue.value);
}));
function getTaskDefinition(element) {
const bo = getBusinessObject(element);
return (getElements(bo, 'zeebe:TaskDefinition') || [])[0];
}
function findExtension(element, type) {
var bo = getBusinessObject(element);
var extensionElements;
if (is(bo, 'bpmn:ExtensionElements')) {
extensionElements = bo;
} else {
extensionElements = bo.extensionElements;
}
if (!extensionElements) {
return null;
}
return find(extensionElements.get('values'), function(e) {
return is(e, type);
});
module.exports = function(group, element, bpmnFactory, translate) {
var bo = getBusinessObject(element);
if (!bo) {
return;
}
var conditionalEventDefinition = eventDefinitionHelper.getConditionalEventDefinition(element);
if (!(is(element, 'bpmn:SequenceFlow') && isConditionalSource(element.source))
&& !conditionalEventDefinition) {
return;
}
var script = scriptImplementation('language', 'body', true, translate);
group.entries.push({
id: 'condition',
label: translate('Condition'),