Dive into secure and efficient coding practices with our curated list of the top 10 examples showcasing 'bpmn-js' in functional components in JavaScript. Our advanced machine learning engine meticulously scans each line of code, cross-referencing millions of open source libraries to ensure your implementation is not just functional, but also robust and secure. Elevate your React applications to new heights by mastering the art of handling side effects, API calls, and asynchronous operations with confidence and precision.
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'));
}));
'use strict';
var TestHelper = require('../../../TestHelper');
var TestContainer = require('mocha-test-container-support');
/* global bootstrapModeler, inject */
var propertiesPanelModule = require('lib'),
domQuery = require('min-dom').query,
coreModule = require('bpmn-js/lib/core').default,
selectionModule = require('diagram-js/lib/features/selection').default,
modelingModule = require('bpmn-js/lib/features/modeling').default,
propertiesProviderModule = require('lib/provider/bpmn'),
getBusinessObject = require('bpmn-js/lib/util/ModelUtil').getBusinessObject;
function getEntry(container, entryId) {
return domQuery('div[data-entry="' + entryId + '"]', container);
}
function getNameField(container) {
var selector = 'div[name=name]';
return domQuery(selector, getEntry(container, 'name'));
}
function getTextBoxRows(field) {
var innerText = field.innerText || '';
var lines = innerText.split(/\r?\n/g);
var rows = lines.length;
describe('in the DOM', function() {
it('should execute', function() {
// then
expect(input.value).to.equal('foo');
});
it('should undo', inject(function(commandStack) {
// when
commandStack.undo();
// then
expect(input.value).to.equal('retries');
}));
it('should redo', inject(function(commandStack) {
// when
commandStack.undo();
commandStack.redo();
// then
describe('on the business object', function() {
it('should execute', function() {
// then
expect(timerDefinition.timeDuration).to.be.ok;
});
it('should undo', inject(function(commandStack) {
// when
commandStack.undo();
// then
expect(timerDefinition.timeDuration).not.to.be.ok;
}));
it('should redo', inject(function(commandStack) {
// when
commandStack.undo();
commandStack.redo();
// then
collapsedSubProcessEntry = queryEntry(popupMenu, 'replace-with-collapsed-subprocess'),
expandedSubProcessEntry = queryEntry(popupMenu, 'replace-with-expanded-subprocess'),
sequentialMultiInstanceEntry = queryEntry(popupMenu, 'toggle-parallel-mi'),
parallelMultiInstanceEntry = queryEntry(popupMenu, 'toggle-sequential-mi');
// then
expect(collapsedSubProcessEntry).to.exist;
expect(expandedSubProcessEntry).to.exist;
expect(receiveTaskEntry).to.exist;
expect(sequentialMultiInstanceEntry).to.exist;
expect(parallelMultiInstanceEntry).to.exist;
}));
it('should contain options for EventBasedGateway', inject(function(
popupMenu, elementRegistry) {
// given
const eventBasedGateway = elementRegistry.get('EventBasedGateway_1');
openPopup(eventBasedGateway);
const exclusiveGatewayEntry = queryEntry(popupMenu, 'replace-with-exclusive-gateway'),
parallelGatewayEntry = queryEntry(popupMenu, 'replace-with-parallel-gateway');
// then
expect(exclusiveGatewayEntry).to.exist;
expect(parallelGatewayEntry).to.exist;
}));
});
it('should undo', inject(function(commandStack) {
// when
commandStack.undo();
// then
const calledElement = getCalledElement(bo);
expect(calledElement).to.be.undefined;
}));
it('should redo', inject(function(commandStack) {
// when
commandStack.undo();
commandStack.redo();
// then
const calledElement = getCalledElement(bo);
expect(calledElement).to.exist;
expect(calledElement.processId).to.equal('foo');
}));
});
it('should activate lasso tool', inject(function(dragging) {
// when
triggerPaletteEntry('lasso-tool');
// then
const context = dragging.context(),
prefix = context.prefix;
expect(prefix).to.equal('lasso.selection');
}));
it('should activate space tool', inject(function(dragging) {
// when
triggerPaletteEntry('space-tool');
// then
const context = dragging.context(),
prefix = context.prefix;
expect(prefix).to.equal('spaceTool.selection');
}));
it('should activate global-connect tool', inject(function(dragging) {
// when
triggerPaletteEntry('global-connect-tool');