2014-05-21 14:23:52 +00:00
|
|
|
'use strict';
|
|
|
|
|
2014-06-18 09:45:30 +00:00
|
|
|
var Matchers = require('../../../Matchers'),
|
|
|
|
TestHelper = require('../../../TestHelper');
|
|
|
|
|
2014-08-05 06:17:22 +00:00
|
|
|
/* global bootstrapViewer, inject */
|
2014-05-21 14:23:52 +00:00
|
|
|
|
|
|
|
|
2014-06-18 09:45:30 +00:00
|
|
|
var fs = require('fs');
|
2014-05-21 14:23:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
describe('import - collapsed container', function() {
|
|
|
|
|
2014-07-30 14:06:32 +00:00
|
|
|
beforeEach(Matchers.addDeepEquals);
|
2014-05-21 14:23:52 +00:00
|
|
|
|
|
|
|
|
2014-05-22 08:51:23 +00:00
|
|
|
describe('in process', function() {
|
2014-05-21 14:23:52 +00:00
|
|
|
|
2014-06-18 09:45:30 +00:00
|
|
|
var diagramXML = fs.readFileSync('test/fixtures/bpmn/import/collapsed.bpmn', 'utf8');
|
2014-05-21 14:23:52 +00:00
|
|
|
|
2014-08-05 06:17:22 +00:00
|
|
|
beforeEach(bootstrapViewer(diagramXML));
|
2014-05-21 14:23:52 +00:00
|
|
|
|
|
|
|
|
2014-06-18 09:45:30 +00:00
|
|
|
it('should import collapsed subProcess', inject(function(elementRegistry) {
|
2014-11-17 16:36:22 +00:00
|
|
|
var collapsedShape = elementRegistry.get('SubProcess_1');
|
|
|
|
var childShape = elementRegistry.get('IntermediateCatchEvent_1');
|
2014-05-21 14:23:52 +00:00
|
|
|
|
2014-05-22 08:51:23 +00:00
|
|
|
expect(collapsedShape.collapsed).toBe(true);
|
|
|
|
expect(childShape.hidden).toBe(true);
|
2014-06-18 09:45:30 +00:00
|
|
|
}));
|
2014-05-21 14:23:52 +00:00
|
|
|
|
|
|
|
|
2014-06-18 09:45:30 +00:00
|
|
|
it('should import collapsed transaction', inject(function(elementRegistry) {
|
2014-11-17 16:36:22 +00:00
|
|
|
var collapsedShape = elementRegistry.get('Transaction_1');
|
|
|
|
var childShape = elementRegistry.get('UserTask_1');
|
2014-05-21 14:23:52 +00:00
|
|
|
|
2014-05-22 08:51:23 +00:00
|
|
|
expect(collapsedShape.collapsed).toBe(true);
|
|
|
|
expect(childShape.hidden).toBe(true);
|
2014-06-18 09:45:30 +00:00
|
|
|
}));
|
2014-05-21 14:23:52 +00:00
|
|
|
|
|
|
|
|
2014-06-18 09:45:30 +00:00
|
|
|
it('should import collapsed adhocSubProcess', inject(function(elementRegistry) {
|
2014-11-17 16:36:22 +00:00
|
|
|
var collapsedShape = elementRegistry.get('AdHocSubProcess_1');
|
|
|
|
var childShape = elementRegistry.get('StartEvent_1');
|
2014-05-21 14:23:52 +00:00
|
|
|
|
2014-05-22 08:51:23 +00:00
|
|
|
expect(collapsedShape.collapsed).toBe(true);
|
|
|
|
expect(childShape.hidden).toBe(true);
|
2014-06-18 09:45:30 +00:00
|
|
|
}));
|
2014-05-22 08:51:23 +00:00
|
|
|
|
2014-05-21 14:23:52 +00:00
|
|
|
|
2014-06-18 09:45:30 +00:00
|
|
|
it('should import collapsed with nested elements', inject(function(elementRegistry) {
|
2014-11-17 16:36:22 +00:00
|
|
|
var collapsedShape = elementRegistry.get('SubProcess_4');
|
|
|
|
var childShape = elementRegistry.get('SubProcess_5');
|
|
|
|
var nestedChildShape = elementRegistry.get('Task_3');
|
2014-05-21 14:23:52 +00:00
|
|
|
|
2014-05-22 08:51:23 +00:00
|
|
|
expect(collapsedShape.collapsed).toBe(true);
|
|
|
|
expect(childShape.hidden).toBe(true);
|
|
|
|
expect(nestedChildShape.hidden).toBe(true);
|
2014-06-18 09:45:30 +00:00
|
|
|
}));
|
2014-06-17 09:18:33 +00:00
|
|
|
|
|
|
|
|
2014-06-18 09:45:30 +00:00
|
|
|
it('should import collapsed with nested elements', inject(function(elementRegistry) {
|
2014-11-17 16:36:22 +00:00
|
|
|
var hiddenEventShape = elementRegistry.get('StartEvent_2');
|
2014-06-17 09:18:33 +00:00
|
|
|
expect(hiddenEventShape.label.hidden).toBe(true);
|
|
|
|
|
2014-11-17 16:36:22 +00:00
|
|
|
var hiddenDataShape = elementRegistry.get('DataObjectReference_1');
|
2014-06-17 09:18:33 +00:00
|
|
|
expect(hiddenDataShape.label.hidden).toBe(true);
|
2014-06-18 09:45:30 +00:00
|
|
|
}));
|
2014-05-22 08:51:23 +00:00
|
|
|
|
|
|
|
|
2014-06-18 09:45:30 +00:00
|
|
|
it('should import expanded subProcess', inject(function(elementRegistry) {
|
2014-11-17 16:36:22 +00:00
|
|
|
var expandedShape = elementRegistry.get('SubProcess_3');
|
|
|
|
var childShape = elementRegistry.get('Task_2');
|
2014-05-22 08:51:23 +00:00
|
|
|
|
|
|
|
expect(expandedShape.collapsed).toBe(false);
|
|
|
|
expect(childShape.hidden).toBe(false);
|
2014-06-18 09:45:30 +00:00
|
|
|
}));
|
2014-05-22 08:51:23 +00:00
|
|
|
|
2014-05-21 14:23:52 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|
2014-05-22 08:51:23 +00:00
|
|
|
describe('in collaboration', function() {
|
|
|
|
|
2014-06-18 09:45:30 +00:00
|
|
|
var diagramXML = fs.readFileSync('test/fixtures/bpmn/import/collapsed-collaboration.bpmn', 'utf8');
|
2014-05-22 08:51:23 +00:00
|
|
|
|
2014-08-05 06:17:22 +00:00
|
|
|
beforeEach(bootstrapViewer(diagramXML));
|
2014-05-22 08:51:23 +00:00
|
|
|
|
|
|
|
|
2014-06-18 09:45:30 +00:00
|
|
|
it('should import collapsed subProcess in pool', inject(function(elementRegistry) {
|
2014-11-17 16:36:22 +00:00
|
|
|
var expandedShape = elementRegistry.get('SubProcess_1');
|
|
|
|
var childShape = elementRegistry.get('Task_1');
|
2014-05-22 08:51:23 +00:00
|
|
|
|
|
|
|
expect(expandedShape.collapsed).toBe(true);
|
|
|
|
expect(childShape.hidden).toBe(true);
|
2014-06-18 09:45:30 +00:00
|
|
|
}));
|
2014-05-22 08:51:23 +00:00
|
|
|
|
|
|
|
|
2014-06-18 09:45:30 +00:00
|
|
|
it('should import expanded subProcess in pool', inject(function(elementRegistry) {
|
2014-11-17 16:36:22 +00:00
|
|
|
var expandedShape = elementRegistry.get('SubProcess_2');
|
|
|
|
var childShape = elementRegistry.get('StartEvent_1');
|
2014-05-22 08:51:23 +00:00
|
|
|
|
|
|
|
expect(expandedShape.collapsed).toBe(false);
|
|
|
|
expect(childShape.hidden).toBe(false);
|
2014-06-18 09:45:30 +00:00
|
|
|
}));
|
2014-05-22 08:51:23 +00:00
|
|
|
|
|
|
|
|
2014-06-18 09:45:30 +00:00
|
|
|
it('should import collapsed subProcess in lane', inject(function(elementRegistry) {
|
2014-11-17 16:36:22 +00:00
|
|
|
var expandedShape = elementRegistry.get('SubProcess_4');
|
|
|
|
var childShape = elementRegistry.get('Task_2');
|
2014-05-22 08:51:23 +00:00
|
|
|
|
|
|
|
expect(expandedShape.collapsed).toBe(true);
|
|
|
|
expect(childShape.hidden).toBe(true);
|
2014-06-18 09:45:30 +00:00
|
|
|
}));
|
2014-05-22 08:51:23 +00:00
|
|
|
|
|
|
|
|
2014-06-18 09:45:30 +00:00
|
|
|
it('should import expanded subProcess in lane', inject(function(elementRegistry) {
|
2014-11-17 16:36:22 +00:00
|
|
|
var expandedShape = elementRegistry.get('SubProcess_3');
|
|
|
|
var childShape = elementRegistry.get('StartEvent_2');
|
2014-05-22 08:51:23 +00:00
|
|
|
|
|
|
|
expect(expandedShape.collapsed).toBe(false);
|
|
|
|
expect(childShape.hidden).toBe(false);
|
2014-06-18 09:45:30 +00:00
|
|
|
}));
|
2014-05-22 08:51:23 +00:00
|
|
|
|
|
|
|
});
|
2014-05-21 14:23:52 +00:00
|
|
|
});
|