2018-04-02 19:01:53 +00:00
|
|
|
import {
|
|
|
|
bootstrapViewer,
|
|
|
|
inject
|
|
|
|
} from 'test/TestHelper';
|
2014-10-31 14:05:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
describe('import - associations', function() {
|
|
|
|
|
|
|
|
describe('should import association', function() {
|
|
|
|
|
2020-04-29 09:02:42 +00:00
|
|
|
it('connecting task -> text annotation', function() {
|
2014-10-31 14:05:16 +00:00
|
|
|
|
2016-12-06 13:51:09 +00:00
|
|
|
var xml = require('./AssociationSpec.text-annotation.bpmn');
|
2014-10-31 14:05:16 +00:00
|
|
|
|
|
|
|
// given
|
2020-04-29 09:02:42 +00:00
|
|
|
return bootstrapViewer(xml)().then(function(result) {
|
|
|
|
|
|
|
|
var err = result.error;
|
|
|
|
|
|
|
|
expect(err).not.to.exist;
|
2014-10-31 14:05:16 +00:00
|
|
|
|
|
|
|
// when
|
|
|
|
inject(function(elementRegistry) {
|
|
|
|
|
2014-11-17 16:36:22 +00:00
|
|
|
var association = elementRegistry.get('Association_1');
|
2014-10-31 14:05:16 +00:00
|
|
|
|
|
|
|
// then
|
2015-12-01 07:27:45 +00:00
|
|
|
expect(association).to.exist;
|
2014-10-31 14:05:16 +00:00
|
|
|
})();
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
2020-04-29 09:02:42 +00:00
|
|
|
it('connecting boundary -> compensate task', function() {
|
2014-10-31 14:05:16 +00:00
|
|
|
|
2016-12-06 13:51:09 +00:00
|
|
|
var xml = require('./AssociationSpec.compensation.bpmn');
|
2014-10-31 14:05:16 +00:00
|
|
|
|
|
|
|
// given
|
2020-04-29 09:02:42 +00:00
|
|
|
return bootstrapViewer(xml)().then(function(result) {
|
|
|
|
|
|
|
|
var err = result.error;
|
|
|
|
|
|
|
|
expect(err).not.to.exist;
|
2014-10-31 14:05:16 +00:00
|
|
|
|
|
|
|
// when
|
|
|
|
inject(function(elementRegistry) {
|
|
|
|
|
2014-11-17 16:36:22 +00:00
|
|
|
var association = elementRegistry.get('Association_1');
|
2014-10-31 14:05:16 +00:00
|
|
|
|
|
|
|
// then
|
2015-12-01 07:27:45 +00:00
|
|
|
expect(association).to.exist;
|
2014-10-31 14:05:16 +00:00
|
|
|
})();
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
describe('should import data association', function() {
|
|
|
|
|
2016-12-06 13:51:09 +00:00
|
|
|
function expectRendered(elementIds) {
|
|
|
|
|
|
|
|
inject(function(elementRegistry, canvas) {
|
|
|
|
|
|
|
|
elementIds.forEach(function(id) {
|
|
|
|
|
|
|
|
var element = elementRegistry.get(id);
|
|
|
|
|
|
|
|
// then
|
|
|
|
expect(element).to.exist;
|
|
|
|
|
|
|
|
// data associations always rendered on root
|
|
|
|
expect(element.parent).to.eql(canvas.getRootElement());
|
|
|
|
});
|
|
|
|
})();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-04-29 09:02:42 +00:00
|
|
|
it('task -> data object -> task', function() {
|
2014-10-31 14:05:16 +00:00
|
|
|
|
2016-12-06 13:51:09 +00:00
|
|
|
var xml = require('./AssociationSpec.data-association.bpmn');
|
2014-10-31 14:05:16 +00:00
|
|
|
|
|
|
|
// given
|
2020-04-29 09:02:42 +00:00
|
|
|
return bootstrapViewer(xml)().then(function(result) {
|
|
|
|
|
|
|
|
var err = result.error;
|
2014-10-31 14:05:16 +00:00
|
|
|
|
2016-12-06 13:51:09 +00:00
|
|
|
// then
|
2020-04-29 09:02:42 +00:00
|
|
|
expect(err).not.to.exist;
|
|
|
|
|
2016-12-06 13:51:09 +00:00
|
|
|
expectRendered([
|
|
|
|
'DataInputAssociation',
|
|
|
|
'DataOutputAssociation'
|
|
|
|
]);
|
2014-10-31 14:05:16 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
2020-04-29 09:02:42 +00:00
|
|
|
it('data input -> task -> data output', function() {
|
2014-10-31 14:05:16 +00:00
|
|
|
|
2016-12-06 13:51:09 +00:00
|
|
|
var xml = require('./AssociationSpec.data-input-output.bpmn');
|
2014-10-31 14:05:16 +00:00
|
|
|
|
|
|
|
// given
|
2020-04-29 09:02:42 +00:00
|
|
|
return bootstrapViewer(xml)().then(function(result) {
|
|
|
|
|
|
|
|
var err = result.error;
|
2014-10-31 14:05:16 +00:00
|
|
|
|
2016-12-06 13:51:09 +00:00
|
|
|
// then
|
2020-04-29 09:02:42 +00:00
|
|
|
expect(err).not.to.exist;
|
|
|
|
|
2016-12-06 13:51:09 +00:00
|
|
|
expectRendered([
|
|
|
|
'DataInputAssociation',
|
|
|
|
'DataOutputAssociation'
|
|
|
|
]);
|
|
|
|
});
|
|
|
|
});
|
2014-10-31 14:05:16 +00:00
|
|
|
|
|
|
|
|
2020-04-29 09:02:42 +00:00
|
|
|
it('in collaboration', function() {
|
2016-12-06 13:51:09 +00:00
|
|
|
|
|
|
|
var xml = require('./AssociationSpec.collaboration.bpmn');
|
|
|
|
|
|
|
|
// given
|
2020-04-29 09:02:42 +00:00
|
|
|
return bootstrapViewer(xml)().then(function(result) {
|
|
|
|
|
|
|
|
var err = result.error;
|
2016-12-06 13:51:09 +00:00
|
|
|
|
|
|
|
// then
|
2020-04-29 09:02:42 +00:00
|
|
|
expect(err).not.to.exist;
|
|
|
|
|
2016-12-06 13:51:09 +00:00
|
|
|
expectRendered([
|
|
|
|
'DataInputAssociation',
|
|
|
|
'DataOutputAssociation'
|
|
|
|
]);
|
2014-10-31 14:05:16 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2016-01-21 14:18:09 +00:00
|
|
|
|
2020-04-29 09:02:42 +00:00
|
|
|
it('catch event -> data object -> throw event', function() {
|
2016-01-21 14:18:09 +00:00
|
|
|
|
2016-12-06 13:51:09 +00:00
|
|
|
var xml = require('./AssociationSpec.events.bpmn');
|
2016-01-21 14:18:09 +00:00
|
|
|
|
|
|
|
// given
|
2020-04-29 09:02:42 +00:00
|
|
|
return bootstrapViewer(xml)().then(function(result) {
|
|
|
|
|
|
|
|
var err = result.error;
|
2016-01-21 14:18:09 +00:00
|
|
|
|
2016-12-06 13:51:09 +00:00
|
|
|
// then
|
2020-04-29 09:02:42 +00:00
|
|
|
expect(err).not.to.exist;
|
|
|
|
|
2016-12-06 13:51:09 +00:00
|
|
|
expectRendered([
|
|
|
|
'DataInputAssociation',
|
|
|
|
'DataOutputAssociation'
|
|
|
|
]);
|
2016-01-21 14:18:09 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2019-08-19 08:05:51 +00:00
|
|
|
|
2020-04-29 09:02:42 +00:00
|
|
|
it('boundary event -> data object', function() {
|
2019-08-19 08:05:51 +00:00
|
|
|
|
|
|
|
var xml = require('./AssociationSpec.data-association.bpmn');
|
|
|
|
|
|
|
|
// given
|
2020-04-29 09:02:42 +00:00
|
|
|
return bootstrapViewer(xml)().then(function(result) {
|
|
|
|
|
|
|
|
var err = result.error;
|
2019-08-19 08:05:51 +00:00
|
|
|
|
|
|
|
// then
|
2020-04-29 09:02:42 +00:00
|
|
|
expect(err).not.to.exist;
|
2019-08-19 08:05:51 +00:00
|
|
|
expectRendered([
|
|
|
|
'DataOutputAssociation_2'
|
|
|
|
]);
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
2014-10-31 14:05:16 +00:00
|
|
|
});
|
|
|
|
|
2020-04-29 09:02:42 +00:00
|
|
|
});
|