bpmn-js/test/spec/features/replace/ReplaceOptionsChooserSpec.js
Nico Rehwaldt 67d81c346c fix(replace): pre-build BPMN elements
This simplifies the ways we work with replacements.

Instead of monkey-patching the original replace functionality we

* create the business object / target object
* pass it to replace

A simple way that works well with our existing infrastructure.

Other changes:

* fixes redo / undo issues.
* splits context-pad + replace

Closes #180
2015-03-11 16:19:09 +01:00

67 lines
1.5 KiB
JavaScript

'use strict';
var TestHelper = require('../../../TestHelper');
/* global bootstrapModeler, inject */
var fs = require('fs');
var modelingModule = require('../../../../lib/features/modeling'),
replaceModule = require('../../../../lib/features/replace'),
coreModule = require('../../../../lib/core');
describe('features/replace - chooser', function() {
var diagramXML = fs.readFileSync('test/fixtures/bpmn/features/replace/01_replace.bpmn', 'utf8');
var testModules = [ coreModule, modelingModule, replaceModule ];
beforeEach(bootstrapModeler(diagramXML, { modules: testModules }));
describe('should show chooser', function() {
it('for task', inject(function(elementRegistry, modeling, bpmnReplace) {
// given
var element = elementRegistry.get('Task_1');
// when
bpmnReplace.openChooser({ x: 100, y: 100 }, element);
// then
expect(null).toBeDefined();
}));
it('for event event', inject(function(elementRegistry, modeling, bpmnReplace) {
// given
var element = elementRegistry.get('StartEvent_1');
// when
bpmnReplace.openChooser({ x: 100, y: 100 }, element);
// then
expect(null).toBeDefined();
}));
it('for gateway event', inject(function(elementRegistry, modeling, bpmnReplace) {
// given
var element = elementRegistry.get('ExclusiveGateway_1');
// when
bpmnReplace.openChooser({ x: 100, y: 100 }, element);
// then
expect(null).toBeDefined();
}));
});
});