How to use bpmn-js - 10 common examples

To help you get started, we’ve selected a few bpmn-js examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bpmn-io / bpmn-js-properties-panel / test / spec / provider / bpmn / DocumentationSpec.js View on Github external
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);
  }));
});
github bpmn-io / bpmn-js-properties-panel / test / spec / provider / bpmn / ProcessParticipantSpec.js View on Github external
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'));
  }));
github bpmn-io / bpmn-js-properties-panel / test / spec / provider / camunda / AsynchronousContinuationsSpec.js View on Github external
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;
  }));
github bpmn-io / bpmn-js-properties-panel / test / spec / provider / bpmn / ProcessParticipantExpandedSpec.js View on Github external
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'));
  }));
github bpmn-io / bpmn-js-properties-panel / test / spec / provider / bpmn / ElementNameSpec.js View on Github external
'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;
github zeebe-io / zeebe-modeler / client / src / app / tabs / bpmn / custom / properties-provider / __tests__ / TaskDefinitionSpec.js View on Github external
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
github zeebe-io / zeebe-modeler / client / src / app / tabs / bpmn / custom / properties-provider / __tests__ / BoundaryEventTimerEventDefinitionSpec.js View on Github external
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
github zeebe-io / zeebe-modeler / client / src / app / tabs / bpmn / custom / __tests__ / CustomReplaceMenuProviderSpec.js View on Github external
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;

  }));
github zeebe-io / zeebe-modeler / client / src / app / tabs / bpmn / custom / properties-provider / __tests__ / CallActivitySpec.js View on Github external
});


      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');
      }));

    });
github zeebe-io / zeebe-modeler / client / src / app / tabs / bpmn / custom / __tests__ / CustomPaletteProviderSpec.js View on Github external
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');