bpmn-js/test/spec/browser/ModelerSpec.js

59 lines
1.1 KiB
JavaScript
Raw Normal View History

var fs = require('fs');
var Modeler = require('../../../lib/Modeler');
var Matchers = require('../Matchers');
describe('Modeler', function() {
beforeEach(Matchers.add);
var container;
beforeEach(function() {
container = document.createElement('div');
document.getElementsByTagName('body')[0].appendChild(container);
});
it('should import simple process', function(done) {
var xml = fs.readFileSync('test/fixtures/bpmn/simple.bpmn', 'utf8');
var renderer = new Modeler(container);
renderer.importXML(xml, function(err) {
done(err);
});
});
it('should import empty definitions', function(done) {
var xml = fs.readFileSync('test/fixtures/bpmn/empty-definitions.bpmn', 'utf8');
var renderer = new Modeler(container);
renderer.importXML(xml, function(err) {
done(err);
});
});
it('should handle errors', function(done) {
var xml = 'invalid stuff';
var renderer = new Modeler(container);
renderer.importXML(xml, function(err) {
expect(err).toBeDefined();
done();
});
});
});