2018-04-02 19:01:53 +00:00
|
|
|
import {
|
|
|
|
bootstrapModeler,
|
|
|
|
inject
|
|
|
|
} from 'test/TestHelper';
|
2015-08-10 13:13:34 +00:00
|
|
|
|
2018-04-02 19:01:53 +00:00
|
|
|
import coreModule from 'lib/core';
|
|
|
|
import modelingModule from 'lib/features/modeling';
|
2015-08-10 13:13:34 +00:00
|
|
|
|
2018-04-02 19:01:53 +00:00
|
|
|
import {
|
|
|
|
is
|
|
|
|
} from 'lib/util/ModelUtil';
|
2015-08-10 13:13:34 +00:00
|
|
|
|
|
|
|
|
2017-12-20 09:37:27 +00:00
|
|
|
describe('util/ModelUtil', function() {
|
2015-08-10 13:13:34 +00:00
|
|
|
|
2015-11-24 11:53:18 +00:00
|
|
|
var diagramXML = require('../../fixtures/bpmn/simple.bpmn');
|
2015-08-10 13:13:34 +00:00
|
|
|
|
2018-04-02 19:01:53 +00:00
|
|
|
beforeEach(bootstrapModeler(diagramXML, {
|
|
|
|
modules: [
|
|
|
|
coreModule,
|
|
|
|
modelingModule
|
|
|
|
]
|
|
|
|
}));
|
2015-08-10 13:13:34 +00:00
|
|
|
|
|
|
|
|
|
|
|
it('should work with diagram element', inject(function(elementFactory) {
|
|
|
|
|
|
|
|
// given
|
|
|
|
var messageFlowConnection = elementFactory.createConnection({ type: 'bpmn:MessageFlow' });
|
|
|
|
|
|
|
|
// then
|
2018-04-02 19:01:53 +00:00
|
|
|
expect(is(messageFlowConnection, 'bpmn:MessageFlow')).to.be.true;
|
|
|
|
expect(is(messageFlowConnection, 'bpmn:BaseElement')).to.be.true;
|
2015-08-10 13:13:34 +00:00
|
|
|
|
2018-04-02 19:01:53 +00:00
|
|
|
expect(is(messageFlowConnection, 'bpmn:SequenceFlow')).to.be.false;
|
|
|
|
expect(is(messageFlowConnection, 'bpmn:Task')).to.be.false;
|
2015-08-10 13:13:34 +00:00
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('should work with business object', inject(function(bpmnFactory) {
|
|
|
|
|
|
|
|
// given
|
|
|
|
var gateway = bpmnFactory.create('bpmn:Gateway');
|
|
|
|
|
|
|
|
// then
|
2018-04-02 19:01:53 +00:00
|
|
|
expect(is(gateway, 'bpmn:Gateway')).to.be.true;
|
|
|
|
expect(is(gateway, 'bpmn:BaseElement')).to.be.true;
|
2015-08-10 13:13:34 +00:00
|
|
|
|
2018-04-02 19:01:53 +00:00
|
|
|
expect(is(gateway, 'bpmn:SequenceFlow')).to.be.false;
|
2015-08-10 13:13:34 +00:00
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('should work with untyped business object', inject(function() {
|
|
|
|
|
|
|
|
// given
|
|
|
|
var foo = { businessObject: 'BAR' };
|
|
|
|
|
|
|
|
// then
|
2018-04-02 19:01:53 +00:00
|
|
|
expect(is(foo, 'FOO')).to.be.false;
|
2015-08-10 13:13:34 +00:00
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('should work with untyped diagram element', inject(function() {
|
|
|
|
|
|
|
|
// given
|
|
|
|
var foo = { };
|
|
|
|
|
|
|
|
// then
|
2018-04-02 19:01:53 +00:00
|
|
|
expect(is(foo, 'FOO')).to.be.false;
|
2015-08-10 13:13:34 +00:00
|
|
|
}));
|
|
|
|
|
|
|
|
});
|