feat(import): pass definitions during import.start event

This commit is contained in:
Nico Rehwaldt 2015-12-08 11:56:44 +01:00
parent 15dd0b006d
commit 65c94ea9ac
2 changed files with 36 additions and 2 deletions

View File

@ -43,7 +43,7 @@ function importBpmnDiagram(diagram, definitions, done) {
walker.handleDefinitions(definitions);
}
eventBus.fire('import.start');
eventBus.fire('import.start', { definitions: definitions });
try {
parse(definitions);

View File

@ -43,7 +43,41 @@ describe('import - Importer', function() {
}
describe('event emitter', function() {
describe('events', function() {
it('should fire <import.start> and <import.success>', function(done) {
// given
var xml = require('../../fixtures/bpmn/import/process.bpmn');
var eventCount = 0;
var eventBus = diagram.get('eventBus');
// log events
eventBus.on('import.start', function(event) {
expect(event.definitions).to.exist;
eventCount++;
});
eventBus.on('import.success', function(event) {
expect(event).to.have.property('error');
expect(event).to.have.property('warnings');
eventCount++;
});
// when
runImport(diagram, xml, function(err, warnings) {
// then
expect(eventCount).to.equal(2);
done(err);
});
});
it('should fire <bpmnElement.added> during import', function(done) {