2014-10-31 14:05:16 +00:00
|
|
|
'use strict';
|
|
|
|
|
2016-06-07 06:46:45 +00:00
|
|
|
require('../../../TestHelper');
|
2014-10-31 14:05:16 +00:00
|
|
|
|
|
|
|
/* global bootstrapViewer, inject */
|
|
|
|
|
|
|
|
|
|
|
|
describe('import - associations', function() {
|
|
|
|
|
|
|
|
describe('should import association', function() {
|
|
|
|
|
|
|
|
it('connecting task -> text annotation', function(done) {
|
|
|
|
|
2016-12-06 13:51:09 +00:00
|
|
|
var xml = require('./AssociationSpec.text-annotation.bpmn');
|
2014-10-31 14:05:16 +00:00
|
|
|
|
|
|
|
// given
|
|
|
|
bootstrapViewer(xml)(function(err) {
|
|
|
|
|
|
|
|
// 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
|
|
|
|
2017-12-04 21:27:32 +00:00
|
|
|
done(err);
|
2014-10-31 14:05:16 +00:00
|
|
|
})();
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
it('connecting boundary -> compensate task', function(done) {
|
|
|
|
|
2016-12-06 13:51:09 +00:00
|
|
|
var xml = require('./AssociationSpec.compensation.bpmn');
|
2014-10-31 14:05:16 +00:00
|
|
|
|
|
|
|
// given
|
|
|
|
bootstrapViewer(xml)(function(err) {
|
|
|
|
|
|
|
|
// 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
|
|
|
|
|
|
|
done();
|
|
|
|
})();
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
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());
|
|
|
|
});
|
|
|
|
})();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-10-31 14:05:16 +00:00
|
|
|
it('task -> data object -> task', function(done) {
|
|
|
|
|
2016-12-06 13:51:09 +00:00
|
|
|
var xml = require('./AssociationSpec.data-association.bpmn');
|
2014-10-31 14:05:16 +00:00
|
|
|
|
|
|
|
// given
|
|
|
|
bootstrapViewer(xml)(function(err) {
|
|
|
|
|
2016-12-06 13:51:09 +00:00
|
|
|
// then
|
|
|
|
expectRendered([
|
|
|
|
'DataInputAssociation',
|
|
|
|
'DataOutputAssociation'
|
|
|
|
]);
|
2014-10-31 14:05:16 +00:00
|
|
|
|
2017-12-04 21:27:32 +00:00
|
|
|
done(err);
|
2014-10-31 14:05:16 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
it('data input -> task -> data output', function(done) {
|
|
|
|
|
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
|
|
|
|
bootstrapViewer(xml)(function(err) {
|
|
|
|
|
2016-12-06 13:51:09 +00:00
|
|
|
// then
|
|
|
|
expectRendered([
|
|
|
|
'DataInputAssociation',
|
|
|
|
'DataOutputAssociation'
|
|
|
|
]);
|
2014-10-31 14:05:16 +00:00
|
|
|
|
2017-12-04 21:27:32 +00:00
|
|
|
done(err);
|
2016-12-06 13:51:09 +00:00
|
|
|
});
|
|
|
|
});
|
2014-10-31 14:05:16 +00:00
|
|
|
|
|
|
|
|
2016-12-06 13:51:09 +00:00
|
|
|
it('in collaboration', function(done) {
|
|
|
|
|
|
|
|
var xml = require('./AssociationSpec.collaboration.bpmn');
|
|
|
|
|
|
|
|
// given
|
|
|
|
bootstrapViewer(xml)(function(err) {
|
|
|
|
|
|
|
|
// then
|
|
|
|
expectRendered([
|
|
|
|
'DataInputAssociation',
|
|
|
|
'DataOutputAssociation'
|
|
|
|
]);
|
|
|
|
|
2017-12-04 21:27:32 +00:00
|
|
|
done(err);
|
2014-10-31 14:05:16 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2016-01-21 14:18:09 +00:00
|
|
|
|
|
|
|
it('catch event -> data object -> throw event', function(done) {
|
|
|
|
|
2016-12-06 13:51:09 +00:00
|
|
|
var xml = require('./AssociationSpec.events.bpmn');
|
2016-01-21 14:18:09 +00:00
|
|
|
|
|
|
|
// given
|
|
|
|
bootstrapViewer(xml)(function(err) {
|
|
|
|
|
2016-12-06 13:51:09 +00:00
|
|
|
// then
|
|
|
|
expectRendered([
|
|
|
|
'DataInputAssociation',
|
|
|
|
'DataOutputAssociation'
|
|
|
|
]);
|
2016-01-21 14:18:09 +00:00
|
|
|
|
2017-12-04 21:27:32 +00:00
|
|
|
done(err);
|
2016-01-21 14:18:09 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2014-10-31 14:05:16 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
});
|