2014-05-21 14:23:52 +00:00
|
|
|
'use strict';
|
|
|
|
|
2016-06-07 06:46:45 +00:00
|
|
|
require('../../TestHelper');
|
2015-07-15 06:50:21 +00:00
|
|
|
|
|
|
|
|
2015-07-15 15:22:19 +00:00
|
|
|
var TestContainer = require('mocha-test-container-support');
|
2014-06-18 09:45:30 +00:00
|
|
|
|
2014-06-11 12:41:55 +00:00
|
|
|
var Diagram = require('diagram-js/lib/Diagram'),
|
2014-08-04 14:32:11 +00:00
|
|
|
BpmnModdle = require('bpmn-moddle'),
|
2017-12-04 21:27:32 +00:00
|
|
|
importBpmnDiagram = require('../../../lib/import/Importer').importBpmnDiagram,
|
2014-08-01 05:16:59 +00:00
|
|
|
Viewer = require('../../../lib/Viewer');
|
2014-04-03 09:47:26 +00:00
|
|
|
|
2016-06-08 07:34:11 +00:00
|
|
|
var find = require('lodash/collection/find');
|
|
|
|
|
2014-05-21 14:23:52 +00:00
|
|
|
|
2015-04-21 12:22:03 +00:00
|
|
|
describe('import - Importer', function() {
|
2014-04-03 09:47:26 +00:00
|
|
|
|
2015-08-25 13:45:44 +00:00
|
|
|
function createDiagram(container, modules) {
|
2014-04-03 09:47:26 +00:00
|
|
|
return new Diagram({
|
|
|
|
canvas: { container: container },
|
2015-08-25 13:45:44 +00:00
|
|
|
modules: modules
|
2014-04-03 09:47:26 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2014-06-23 12:44:03 +00:00
|
|
|
var diagram;
|
2014-05-21 14:23:52 +00:00
|
|
|
|
2014-06-23 12:44:03 +00:00
|
|
|
beforeEach(function() {
|
2015-08-25 13:45:44 +00:00
|
|
|
diagram = createDiagram(TestContainer.get(this), Viewer.prototype._modules);
|
2014-06-23 12:44:03 +00:00
|
|
|
});
|
2014-04-03 09:47:26 +00:00
|
|
|
|
|
|
|
|
2014-06-23 12:44:03 +00:00
|
|
|
function runImport(diagram, xml, done) {
|
2015-08-25 13:45:44 +00:00
|
|
|
|
|
|
|
var moddle = new BpmnModdle();
|
|
|
|
|
2014-08-04 14:32:11 +00:00
|
|
|
moddle.fromXML(xml, function(err, definitions) {
|
2017-12-04 21:27:32 +00:00
|
|
|
importBpmnDiagram(diagram, definitions, done);
|
2014-06-23 12:44:03 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-12-08 10:56:44 +00:00
|
|
|
describe('events', function() {
|
|
|
|
|
2016-03-17 08:39:43 +00:00
|
|
|
it('should fire <import.render.start> and <import.render.complete>', function(done) {
|
2015-12-08 10:56:44 +00:00
|
|
|
|
|
|
|
// given
|
|
|
|
var xml = require('../../fixtures/bpmn/import/process.bpmn');
|
|
|
|
|
|
|
|
var eventCount = 0;
|
|
|
|
|
|
|
|
var eventBus = diagram.get('eventBus');
|
|
|
|
|
|
|
|
// log events
|
2016-03-17 08:39:43 +00:00
|
|
|
eventBus.on('import.render.start', function(event) {
|
2015-12-08 10:56:44 +00:00
|
|
|
expect(event.definitions).to.exist;
|
|
|
|
|
|
|
|
eventCount++;
|
|
|
|
});
|
|
|
|
|
2016-03-17 08:39:43 +00:00
|
|
|
eventBus.on('import.render.complete', function(event) {
|
2015-12-08 10:56:44 +00:00
|
|
|
expect(event).to.have.property('error');
|
|
|
|
expect(event).to.have.property('warnings');
|
|
|
|
|
|
|
|
eventCount++;
|
|
|
|
});
|
|
|
|
|
|
|
|
// when
|
|
|
|
runImport(diagram, xml, function(err, warnings) {
|
|
|
|
|
|
|
|
// then
|
|
|
|
expect(eventCount).to.equal(2);
|
|
|
|
|
|
|
|
done(err);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2014-06-23 12:44:03 +00:00
|
|
|
|
2015-07-15 06:50:21 +00:00
|
|
|
it('should fire <bpmnElement.added> during import', function(done) {
|
2014-06-23 12:44:03 +00:00
|
|
|
|
|
|
|
// given
|
2015-07-15 06:50:21 +00:00
|
|
|
var xml = require('../../fixtures/bpmn/import/process.bpmn');
|
2014-06-23 12:44:03 +00:00
|
|
|
|
2014-07-01 09:33:28 +00:00
|
|
|
var eventCount = 0;
|
2014-06-23 12:44:03 +00:00
|
|
|
|
|
|
|
// log events
|
2014-07-16 14:15:23 +00:00
|
|
|
diagram.get('eventBus').on('bpmnElement.added', function(e) {
|
2014-07-01 09:33:28 +00:00
|
|
|
eventCount++;
|
2014-06-23 12:44:03 +00:00
|
|
|
});
|
|
|
|
|
2014-04-03 09:47:26 +00:00
|
|
|
// when
|
2014-06-23 12:44:03 +00:00
|
|
|
runImport(diagram, xml, function(err, warnings) {
|
2014-04-03 09:47:26 +00:00
|
|
|
|
|
|
|
// then
|
2015-07-15 15:22:19 +00:00
|
|
|
expect(eventCount).to.equal(9);
|
2014-04-03 09:47:26 +00:00
|
|
|
|
|
|
|
done(err);
|
|
|
|
});
|
|
|
|
});
|
2014-06-23 12:44:03 +00:00
|
|
|
|
2014-04-03 09:47:26 +00:00
|
|
|
});
|
|
|
|
|
2014-06-18 11:05:32 +00:00
|
|
|
|
2014-06-23 12:44:03 +00:00
|
|
|
describe('basics', function() {
|
2014-06-18 11:05:32 +00:00
|
|
|
|
2015-07-15 06:50:21 +00:00
|
|
|
it('should import process', function(done) {
|
2014-06-18 11:05:32 +00:00
|
|
|
|
2014-06-23 12:44:03 +00:00
|
|
|
// given
|
2015-07-15 06:50:21 +00:00
|
|
|
var xml = require('../../fixtures/bpmn/import/process.bpmn');
|
2014-06-18 11:05:32 +00:00
|
|
|
|
2014-06-23 12:44:03 +00:00
|
|
|
var events = [];
|
2014-06-18 11:05:32 +00:00
|
|
|
|
2014-06-23 12:44:03 +00:00
|
|
|
// log events
|
2014-07-16 14:15:23 +00:00
|
|
|
diagram.get('eventBus').on('bpmnElement.added', function(e) {
|
2014-07-01 09:33:28 +00:00
|
|
|
events.push({
|
|
|
|
type: 'add',
|
2014-07-16 14:15:23 +00:00
|
|
|
semantic: e.element.businessObject.id,
|
|
|
|
di: e.element.businessObject.di.id,
|
|
|
|
diagramElement: e.element && e.element.id
|
2014-07-01 09:33:28 +00:00
|
|
|
});
|
2014-06-23 12:44:03 +00:00
|
|
|
});
|
2014-06-18 11:05:32 +00:00
|
|
|
|
|
|
|
// when
|
2014-06-23 12:44:03 +00:00
|
|
|
runImport(diagram, xml, function(err, warnings) {
|
|
|
|
|
|
|
|
// then
|
2015-07-15 15:22:19 +00:00
|
|
|
expect(events).to.eql([
|
2014-11-28 10:38:06 +00:00
|
|
|
{ type: 'add', semantic: 'Process_1', di: 'BPMNPlane_1', diagramElement: 'Process_1' },
|
|
|
|
{ type: 'add', semantic: 'SubProcess_1', di: '_BPMNShape_SubProcess_2', diagramElement: 'SubProcess_1' },
|
|
|
|
{ type: 'add', semantic: 'StartEvent_1', di: '_BPMNShape_StartEvent_2', diagramElement: 'StartEvent_1' },
|
|
|
|
{ type: 'add', semantic: 'Task_1', di: '_BPMNShape_Task_2', diagramElement: 'Task_1' },
|
|
|
|
{ type: 'add', semantic: 'EndEvent_1', di: '_BPMNShape_EndEvent_2', diagramElement: 'EndEvent_1' },
|
|
|
|
{ type: 'add', semantic: 'StartEvent_2', di: '_BPMNShape_StartEvent_11', diagramElement: 'StartEvent_2' },
|
|
|
|
{ type: 'add', semantic: 'SequenceFlow_1', di: 'BPMNEdge_SequenceFlow_1', diagramElement: 'SequenceFlow_1' },
|
|
|
|
{ type: 'add', semantic: 'SequenceFlow_2', di: 'BPMNEdge_SequenceFlow_2', diagramElement: 'SequenceFlow_2' },
|
|
|
|
{ type: 'add', semantic: 'SequenceFlow_3', di: 'BPMNEdge_SequenceFlow_3', diagramElement: 'SequenceFlow_3' }
|
2014-06-23 12:44:03 +00:00
|
|
|
]);
|
|
|
|
|
|
|
|
done(err);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
it('should import collaboration', function(done) {
|
|
|
|
|
|
|
|
// given
|
2015-07-15 06:50:21 +00:00
|
|
|
var xml = require('../../fixtures/bpmn/import/collaboration.bpmn');
|
2014-06-23 12:44:03 +00:00
|
|
|
|
|
|
|
var events = [];
|
|
|
|
|
|
|
|
// log events
|
2014-07-16 14:15:23 +00:00
|
|
|
diagram.get('eventBus').on('bpmnElement.added', function(e) {
|
2014-07-01 09:33:28 +00:00
|
|
|
events.push({
|
|
|
|
type: 'add',
|
2014-07-16 14:15:23 +00:00
|
|
|
semantic: e.element.businessObject.id,
|
|
|
|
di: e.element.businessObject.di.id,
|
|
|
|
diagramElement: e.element && e.element.id
|
2014-07-01 09:33:28 +00:00
|
|
|
});
|
2014-06-23 12:44:03 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
// when
|
|
|
|
runImport(diagram, xml, function(err, warnings) {
|
|
|
|
|
|
|
|
// then
|
2015-07-15 15:22:19 +00:00
|
|
|
expect(events).to.eql([
|
2014-07-16 14:15:23 +00:00
|
|
|
{ type: 'add', semantic: '_Collaboration_2', di: 'BPMNPlane_1', diagramElement: '_Collaboration_2' },
|
2014-06-23 12:44:03 +00:00
|
|
|
{ type: 'add', semantic: 'Participant_2', di: '_BPMNShape_Participant_2', diagramElement: 'Participant_2' },
|
|
|
|
{ type: 'add', semantic: 'Lane_1', di: '_BPMNShape_Lane_2', diagramElement: 'Lane_1' },
|
|
|
|
{ type: 'add', semantic: 'Lane_2', di: '_BPMNShape_Lane_3', diagramElement: 'Lane_2' },
|
|
|
|
{ type: 'add', semantic: 'Lane_3', di: '_BPMNShape_Lane_4', diagramElement: 'Lane_3' },
|
|
|
|
{ type: 'add', semantic: 'Task_1', di: '_BPMNShape_Task_3', diagramElement: 'Task_1' },
|
|
|
|
{ type: 'add', semantic: 'Participant_1', di: '_BPMNShape_Participant_3', diagramElement: 'Participant_1' },
|
|
|
|
{ type: 'add', semantic: 'StartEvent_1', di: '_BPMNShape_StartEvent_3', diagramElement: 'StartEvent_1' }
|
|
|
|
]);
|
|
|
|
|
|
|
|
done(err);
|
|
|
|
});
|
2015-08-25 13:45:44 +00:00
|
|
|
|
2014-06-23 12:44:03 +00:00
|
|
|
});
|
|
|
|
|
2015-08-25 13:45:44 +00:00
|
|
|
});
|
2014-07-16 14:15:23 +00:00
|
|
|
|
|
|
|
|
2015-08-25 13:45:44 +00:00
|
|
|
describe('position', function() {
|
2014-07-16 14:15:23 +00:00
|
|
|
|
2015-08-25 13:45:44 +00:00
|
|
|
var xml = require('../../fixtures/bpmn/import/position/position-testcase.bpmn');
|
|
|
|
|
|
|
|
it('should round shape\'s x and y coordinates', function(done) {
|
|
|
|
|
|
|
|
// given
|
|
|
|
var events = {};
|
2014-07-16 14:15:23 +00:00
|
|
|
|
|
|
|
// log events
|
|
|
|
diagram.get('eventBus').on('bpmnElement.added', function(e) {
|
2015-08-25 13:45:44 +00:00
|
|
|
|
|
|
|
events[e.element.id] = e.element;
|
2014-07-16 14:15:23 +00:00
|
|
|
});
|
|
|
|
|
2015-07-15 06:50:21 +00:00
|
|
|
runImport(diagram, xml, function(err, warnings) {
|
|
|
|
|
2015-08-25 13:45:44 +00:00
|
|
|
//round up
|
|
|
|
expect(events.ID_End.x).to.equal(Math.round(340.6));
|
|
|
|
expect(events.ID_End.y).to.equal(Math.round(136.6));
|
|
|
|
|
|
|
|
//round down
|
|
|
|
expect(events.ID_Start.x).to.equal(Math.round(120.4));
|
|
|
|
expect(events.ID_Start.y).to.equal(Math.round(135.4));
|
2015-07-15 06:50:21 +00:00
|
|
|
|
|
|
|
done(err);
|
|
|
|
});
|
2014-07-16 14:15:23 +00:00
|
|
|
});
|
2014-06-23 12:44:03 +00:00
|
|
|
|
2014-11-26 10:49:14 +00:00
|
|
|
|
2015-08-25 13:45:44 +00:00
|
|
|
it('should round shape\'s height and width', function(done) {
|
2015-07-15 06:50:21 +00:00
|
|
|
|
2015-08-25 13:45:44 +00:00
|
|
|
// given
|
|
|
|
var events = {};
|
2015-07-15 06:50:21 +00:00
|
|
|
|
2015-08-25 13:45:44 +00:00
|
|
|
// log events
|
|
|
|
diagram.get('eventBus').on('bpmnElement.added', function(e) {
|
2015-07-15 06:50:21 +00:00
|
|
|
|
2015-08-25 13:45:44 +00:00
|
|
|
events[e.element.id] = e.element;
|
|
|
|
});
|
2015-07-15 06:50:21 +00:00
|
|
|
|
2015-08-25 13:45:44 +00:00
|
|
|
runImport(diagram, xml, function(err, warnings) {
|
2015-07-15 06:50:21 +00:00
|
|
|
|
2015-08-25 13:45:44 +00:00
|
|
|
//round down
|
|
|
|
expect(events.ID_Start.height).to.equal(Math.round(30.4));
|
|
|
|
expect(events.ID_Start.width).to.equal(Math.round(30.4));
|
2015-07-15 06:50:21 +00:00
|
|
|
|
2015-08-25 13:45:44 +00:00
|
|
|
done(err);
|
|
|
|
});
|
2014-07-16 14:15:23 +00:00
|
|
|
});
|
|
|
|
|
2015-08-25 13:45:44 +00:00
|
|
|
});
|
2014-07-16 14:15:23 +00:00
|
|
|
|
|
|
|
|
2015-08-25 13:45:44 +00:00
|
|
|
describe('elements', function() {
|
2015-07-15 06:50:21 +00:00
|
|
|
|
2015-08-25 13:45:44 +00:00
|
|
|
it('should import boundary events', function(done) {
|
2015-07-15 06:50:21 +00:00
|
|
|
|
2015-08-25 13:45:44 +00:00
|
|
|
// given
|
|
|
|
var xml = require('../../fixtures/bpmn/import/boundaryEvent.bpmn');
|
2015-07-15 06:50:21 +00:00
|
|
|
|
2015-08-25 13:45:44 +00:00
|
|
|
var events = [];
|
2014-07-16 14:15:23 +00:00
|
|
|
|
2015-08-25 13:45:44 +00:00
|
|
|
// log events
|
|
|
|
diagram.get('eventBus').on('bpmnElement.added', function(e) {
|
|
|
|
events.push({
|
|
|
|
type: 'add',
|
|
|
|
semantic: e.element.businessObject.id,
|
|
|
|
di: e.element.businessObject.di.id,
|
|
|
|
diagramElement: e.element && e.element.id
|
|
|
|
});
|
|
|
|
});
|
2014-07-16 14:15:23 +00:00
|
|
|
|
2015-08-25 13:45:44 +00:00
|
|
|
// when
|
|
|
|
runImport(diagram, xml, function(err, warnings) {
|
2014-07-16 14:15:23 +00:00
|
|
|
|
2015-07-15 06:50:21 +00:00
|
|
|
// then
|
2015-08-25 13:45:44 +00:00
|
|
|
expect(events).to.eql([
|
2016-06-07 06:46:45 +00:00
|
|
|
{ type: 'add', semantic: 'Process_1', di: 'BPMNPlane_1', diagramElement: 'Process_1' },
|
|
|
|
{ type: 'add', semantic: 'Task_1', di: '_BPMNShape_Task_2', diagramElement: 'Task_1' },
|
|
|
|
{ type: 'add', semantic: 'Task_2', di: '_BPMNShape_Task_3', diagramElement: 'Task_2' },
|
|
|
|
{ type: 'add', semantic: 'BoundaryEvent_1', di: '_BPMNShape_BoundaryEvent_2', diagramElement: 'BoundaryEvent_1' },
|
|
|
|
{ type: 'add', semantic: 'SequenceFlow_1', di: 'BPMNEdge_SequenceFlow_1', diagramElement: 'SequenceFlow_1' }
|
2015-08-25 13:45:44 +00:00
|
|
|
]);
|
2014-07-16 14:15:23 +00:00
|
|
|
|
2015-08-25 13:45:44 +00:00
|
|
|
done(err);
|
|
|
|
});
|
2014-06-18 11:05:32 +00:00
|
|
|
});
|
2014-06-23 12:44:03 +00:00
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
describe('forgiveness', function() {
|
|
|
|
|
|
|
|
it('should import invalid flowElement', function(done) {
|
|
|
|
|
|
|
|
// given
|
2015-07-15 06:50:21 +00:00
|
|
|
var xml = require('../../fixtures/bpmn/import/error/invalid-flow-element.bpmn');
|
2014-06-23 12:44:03 +00:00
|
|
|
|
|
|
|
// when
|
|
|
|
runImport(diagram, xml, function(err, warnings) {
|
|
|
|
|
2015-10-09 23:33:21 +00:00
|
|
|
expect(warnings.length).to.equal(0);
|
2014-06-23 12:44:03 +00:00
|
|
|
|
|
|
|
done(err);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2014-11-26 19:54:52 +00:00
|
|
|
|
2015-04-21 12:22:03 +00:00
|
|
|
it('should import multiple DIs', function(done) {
|
2014-11-26 19:54:52 +00:00
|
|
|
|
|
|
|
// given
|
2015-07-15 06:50:21 +00:00
|
|
|
var xml = require('../../fixtures/bpmn/import/error/multiple-dis.bpmn');
|
2014-11-26 19:54:52 +00:00
|
|
|
|
|
|
|
// when
|
|
|
|
runImport(diagram, xml, function(err, warnings) {
|
|
|
|
|
2015-02-17 09:55:28 +00:00
|
|
|
var expectedMessage =
|
|
|
|
'multiple DI elements defined for <bpmn:InclusiveGateway id="InclusiveGateway_1" />';
|
|
|
|
|
2015-07-15 15:22:19 +00:00
|
|
|
expect(warnings.length).to.equal(1);
|
|
|
|
expect(warnings[0].message).to.equal(expectedMessage);
|
2014-11-26 19:54:52 +00:00
|
|
|
|
|
|
|
done(err);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
2015-04-21 12:22:03 +00:00
|
|
|
it('should extend attributes with default value', function(done) {
|
2014-08-18 10:38:41 +00:00
|
|
|
|
|
|
|
// given
|
2015-04-21 12:22:03 +00:00
|
|
|
var xml = require('../../fixtures/bpmn/import/default-attrs.bpmn');
|
2014-08-18 10:38:41 +00:00
|
|
|
|
|
|
|
// when
|
|
|
|
runImport(diagram, xml, function(err, warnings) {
|
|
|
|
|
|
|
|
var elementRegistry = diagram.get('elementRegistry');
|
|
|
|
|
2014-11-17 16:36:22 +00:00
|
|
|
var element = elementRegistry.get('GATEWAY_1');
|
2014-08-18 10:38:41 +00:00
|
|
|
|
2015-07-15 15:22:19 +00:00
|
|
|
expect(element.businessObject.eventGatewayType).to.equal('Exclusive');
|
2014-08-18 10:38:41 +00:00
|
|
|
|
|
|
|
done();
|
|
|
|
});
|
2014-10-31 14:05:16 +00:00
|
|
|
});
|
|
|
|
|
2015-07-15 06:50:21 +00:00
|
|
|
|
|
|
|
describe('boundary events', function() {
|
|
|
|
|
|
|
|
it('should handle missing attachToRef', function(done) {
|
|
|
|
|
|
|
|
// given
|
|
|
|
var xml = require('../../fixtures/bpmn/import/error/boundaryEvent-missingAttachToRef.bpmn');
|
|
|
|
|
|
|
|
// when
|
|
|
|
runImport(diagram, xml, function(err, warnings) {
|
|
|
|
|
|
|
|
// then
|
|
|
|
expect(warnings.length).to.eql(2);
|
|
|
|
|
|
|
|
expect(warnings[0].message).to.eql('missing <bpmn:BoundaryEvent id="BoundaryEvent_1" />#attachedToRef');
|
|
|
|
expect(warnings[1].message).to.eql('element <bpmn:BoundaryEvent id="BoundaryEvent_1" /> referenced by <bpmn:SequenceFlow id="SequenceFlow_1" />#sourceRef not yet drawn');
|
|
|
|
|
|
|
|
done(err);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
it('should handle invalid attachToRef', function(done) {
|
|
|
|
|
|
|
|
// given
|
|
|
|
var xml = require('../../fixtures/bpmn/import/error/boundaryEvent-invalidAttachToRef.bpmn');
|
|
|
|
|
|
|
|
// when
|
|
|
|
runImport(diagram, xml, function(err, warnings) {
|
|
|
|
|
|
|
|
// then
|
|
|
|
expect(warnings.length).to.eql(2);
|
|
|
|
|
|
|
|
expect(warnings[0].message).to.eql('missing <bpmn:BoundaryEvent id="BoundaryEvent_1" />#attachedToRef');
|
|
|
|
expect(warnings[1].message).to.eql('element <bpmn:BoundaryEvent id="BoundaryEvent_1" /> referenced by <bpmn:SequenceFlow id="SequenceFlow_1" />#sourceRef not yet drawn');
|
|
|
|
|
|
|
|
done(err);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
2014-10-31 14:05:16 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
describe('integration', function() {
|
|
|
|
|
2015-01-02 11:56:32 +00:00
|
|
|
it('should import dangling process message flows', function(done) {
|
|
|
|
|
|
|
|
// given
|
2015-07-15 06:50:21 +00:00
|
|
|
var xml = require('../../fixtures/bpmn/import/error/dangling-process-message-flow.bpmn');
|
2015-01-02 11:56:32 +00:00
|
|
|
|
|
|
|
// when
|
|
|
|
runImport(diagram, xml, function(err, warnings) {
|
|
|
|
|
|
|
|
// then
|
2015-07-15 15:22:19 +00:00
|
|
|
expect(warnings.length).to.equal(0);
|
2015-01-02 11:56:32 +00:00
|
|
|
|
2015-12-01 07:27:45 +00:00
|
|
|
expect(diagram.get('elementRegistry').get('_b467921a-ef7b-44c5-bf78-fd624c400d17')).to.exist;
|
|
|
|
expect(diagram.get('elementRegistry').get('_c311cc87-677e-47a4-bdb1-8744c4ec3147')).to.exist;
|
2015-01-02 11:56:32 +00:00
|
|
|
|
|
|
|
done(err);
|
|
|
|
});
|
|
|
|
});
|
2015-07-15 06:50:21 +00:00
|
|
|
|
2014-06-18 11:05:32 +00:00
|
|
|
});
|
|
|
|
|
2016-06-08 07:34:11 +00:00
|
|
|
|
|
|
|
describe('hiding', function() {
|
|
|
|
|
|
|
|
it('should hide shapes and connections inside of collapsed subprocess', function(done) {
|
|
|
|
|
|
|
|
// given
|
|
|
|
var xml = require('../../fixtures/bpmn/import/collapsed/processWithChildren.bpmn');
|
|
|
|
|
|
|
|
// when
|
|
|
|
runImport(diagram, xml, function(err, warnings) {
|
|
|
|
|
|
|
|
var elementRegistry = diagram.get('elementRegistry');
|
|
|
|
|
|
|
|
var children = elementRegistry.get('SubProcess_1').children;
|
|
|
|
var visible = find(children, function(child) {
|
|
|
|
return !child.hidden;
|
|
|
|
});
|
|
|
|
|
|
|
|
// then
|
|
|
|
expect(visible).to.be.undefined;
|
|
|
|
|
|
|
|
done(err);
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|