2014-08-04 14:32:11 +00:00
|
|
|
var BpmnModdle = require('bpmn-moddle');
|
2014-03-11 14:54:36 +00:00
|
|
|
|
2014-06-18 09:45:30 +00:00
|
|
|
describe('model - browser support', function() {
|
2014-03-11 14:54:36 +00:00
|
|
|
|
2014-08-04 14:32:11 +00:00
|
|
|
var moddle = new BpmnModdle();
|
|
|
|
|
2014-03-11 14:54:36 +00:00
|
|
|
function read(xml, callback, done) {
|
|
|
|
|
2014-08-04 14:32:11 +00:00
|
|
|
moddle.fromXML(xml, 'bpmn:Definitions', function(err, definitions) {
|
2014-03-11 14:54:36 +00:00
|
|
|
|
|
|
|
if (err) {
|
|
|
|
done(err);
|
|
|
|
} else {
|
|
|
|
callback(definitions);
|
|
|
|
done();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2014-08-04 14:32:11 +00:00
|
|
|
|
2014-03-11 14:54:36 +00:00
|
|
|
it('should parse simple xml', function(done) {
|
|
|
|
|
|
|
|
var xml =
|
|
|
|
'<?xml version="1.0" encoding="UTF-8"?>' +
|
2014-03-21 15:43:15 +00:00
|
|
|
'<bpmn2:definitions xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" id="simple" targetNamespace="http://bpmn.io/schema/bpmn">' +
|
2014-03-11 14:54:36 +00:00
|
|
|
'<bpmn2:process id="Process_1">' +
|
|
|
|
'</bpmn2:process>' +
|
|
|
|
'</bpmn2:definitions>';
|
|
|
|
|
|
|
|
// when
|
|
|
|
read(xml, function(definitions) {
|
|
|
|
|
|
|
|
// then
|
|
|
|
expect(definitions.id).toBe('simple');
|
2014-03-21 15:43:15 +00:00
|
|
|
expect(definitions.targetNamespace).toBe('http://bpmn.io/schema/bpmn');
|
2014-03-11 14:54:36 +00:00
|
|
|
|
|
|
|
expect(definitions.rootElements.length).toBe(1);
|
|
|
|
expect(definitions.rootElements[0].id).toBe('Process_1');
|
|
|
|
}, done);
|
|
|
|
});
|
|
|
|
});
|