How to use the bpmn-js/test/helper.inject function in bpmn-js

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

  let container;

  beforeEach(function() {
    container = TestContainer.get(this);
  });

  beforeEach(bootstrapModeler(diagramXML, {
    modules: testModules,
    moddleExtensions
  }));


  beforeEach(inject(function(commandStack, propertiesPanel) {

    const undoButton = document.createElement('button');
    undoButton.textContent = 'UNDO';

    undoButton.addEventListener('click', () => {
      commandStack.undo();
    });

    container.appendChild(undoButton);

    propertiesPanel.attachTo(container);
  }));

  it('should fetch empty list of input and output parameters', inject(function(selection, elementRegistry) {

    // given
github zeebe-io / zeebe-modeler / client / src / app / tabs / bpmn / custom / properties-provider / __tests__ / StartEventTimerEventDefinitionSpec.js View on Github external
describe('of time date', function() {

      let input, timeDate;

      beforeEach(inject(function(elementRegistry, selection) {

        // given
        const shape = elementRegistry.get('TIME_DATE');
        selection.select(shape);

        const bo = getBusinessObject(shape);
        const timerDefinition = eventDefinitionHelper.getTimerEventDefinition(bo);
        timeDate = timerDefinition.timeDate;

        input = getTimerDefinitionField(container);

        // when
        triggerValue(input, 'foo', 'change');
      }));

      describe('in the DOM', function() {
github zeebe-io / zeebe-modeler / client / src / app / tabs / bpmn / custom / properties-provider / __tests__ / SequenceFlowSpec.js View on Github external
describe('creation', function() {

      let bo;

      beforeEach(inject(function(elementRegistry, selection) {

        // given
        const shape = elementRegistry.get('SequenceFlow_1');
        selection.select(shape);

        bo = getBusinessObject(shape);

        // assume
        expect(getConditionExpression(bo)).to.be.undefined;

        const input = getInputField(container, 'zeebe-condition', 'condition');

        // when
        triggerValue(input, 'foo', 'change');
      }));
github zeebe-io / zeebe-modeler / client / src / app / tabs / bpmn / custom / properties-provider / __tests__ / BoundaryEventTimerEventDefinitionSpec.js View on Github external
describe('change timer definition', function() {

    let container;

    beforeEach(inject(function(propertiesPanel) {
      container = propertiesPanel._container;
    }));

    describe('of time duration', function() {

      let input, timeDuration;

      beforeEach(inject(function(elementRegistry, selection) {

        // given
        const shape = elementRegistry.get('TIME_DURATION');
        selection.select(shape);

        const bo = getBusinessObject(shape);
        const timerDefinition = eventDefinitionHelper.getTimerEventDefinition(bo);
        timeDuration = timerDefinition.timeDuration;
github zeebe-io / zeebe-modeler / client / src / app / tabs / bpmn / custom / properties-provider / __tests__ / ErrorSpec.js View on Github external
it('should execute', function() {

            expect(errorEventDefinition.errorRef.name).to.equal('Error1');

          });


          it('should undo', inject(function(commandStack) {

            commandStack.undo();
            expect(errorEventDefinition.errorRef.name).to.equal('Error2');

          }));


          it('should redo', inject(function(commandStack) {

            commandStack.undo();
            commandStack.redo();
            expect(errorEventDefinition.errorRef.name).to.equal('Error1');

          }));

        });