2014-03-13 16:06:30 +01:00
|
|
|
var fs = require('fs');
|
|
|
|
|
2014-04-25 13:30:10 +02:00
|
|
|
var Modeler = require('../../../lib/Modeler');
|
2014-03-13 16:06:30 +01:00
|
|
|
|
|
|
|
var Matchers = require('../Matchers');
|
|
|
|
|
|
|
|
|
2014-04-25 13:30:10 +02:00
|
|
|
describe('Modeler', function() {
|
2014-03-13 16:06:30 +01:00
|
|
|
|
2014-04-25 13:30:10 +02:00
|
|
|
beforeEach(Matchers.add);
|
2014-03-13 16:06:30 +01:00
|
|
|
|
|
|
|
var container;
|
|
|
|
|
|
|
|
beforeEach(function() {
|
|
|
|
container = document.createElement('div');
|
|
|
|
document.getElementsByTagName('body')[0].appendChild(container);
|
|
|
|
});
|
|
|
|
|
2014-03-21 21:10:01 +01:00
|
|
|
|
2014-03-13 16:06:30 +01:00
|
|
|
it('should import simple process', function(done) {
|
|
|
|
|
|
|
|
var xml = fs.readFileSync('test/fixtures/bpmn/simple.bpmn', 'utf8');
|
|
|
|
|
2014-04-03 11:47:26 +02:00
|
|
|
var renderer = new Modeler(container);
|
2014-03-13 16:06:30 +01:00
|
|
|
|
2014-03-21 21:10:01 +01:00
|
|
|
renderer.importXML(xml, function(err) {
|
|
|
|
done(err);
|
2014-03-13 16:06:30 +01:00
|
|
|
});
|
|
|
|
});
|
2014-04-25 13:30:10 +02:00
|
|
|
|
|
|
|
|
2014-03-17 11:11:25 +01:00
|
|
|
it('should import empty definitions', function(done) {
|
|
|
|
|
|
|
|
var xml = fs.readFileSync('test/fixtures/bpmn/empty-definitions.bpmn', 'utf8');
|
|
|
|
|
2014-04-03 11:47:26 +02:00
|
|
|
var renderer = new Modeler(container);
|
2014-03-21 21:10:01 +01:00
|
|
|
|
|
|
|
renderer.importXML(xml, function(err) {
|
2014-04-03 11:47:26 +02:00
|
|
|
|
2014-03-21 21:10:01 +01:00
|
|
|
done(err);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
it('should handle errors', function(done) {
|
|
|
|
|
|
|
|
var xml = 'invalid stuff';
|
2014-03-17 11:11:25 +01:00
|
|
|
|
2014-04-03 11:47:26 +02:00
|
|
|
var renderer = new Modeler(container);
|
2014-03-21 21:10:01 +01:00
|
|
|
|
|
|
|
renderer.importXML(xml, function(err) {
|
|
|
|
|
|
|
|
expect(err).toBeDefined();
|
|
|
|
|
|
|
|
done();
|
2014-03-17 11:11:25 +01:00
|
|
|
});
|
|
|
|
});
|
2014-03-21 21:10:01 +01:00
|
|
|
|
2014-03-13 16:06:30 +01:00
|
|
|
});
|