fix(import/Importer): clear commandStack after import
This commit is contained in:
parent
134c65bdd9
commit
c7da579f83
|
@ -85,6 +85,7 @@ function importBpmnDiagram(diagram, definitions, done) {
|
|||
|
||||
var canvas = diagram.get('canvas');
|
||||
var events = diagram.get('eventBus');
|
||||
var commandStack = diagram.get('commandStack');
|
||||
|
||||
|
||||
function addLabel(element, di, data) {
|
||||
|
@ -167,6 +168,8 @@ function importBpmnDiagram(diagram, definitions, done) {
|
|||
var walker = new BpmnTreeWalker(visitor);
|
||||
walker.handleDefinitions(definitions);
|
||||
|
||||
commandStack.clear();
|
||||
|
||||
done();
|
||||
}
|
||||
|
||||
|
|
|
@ -76,4 +76,29 @@ describe('import - importer', function() {
|
|||
});
|
||||
});
|
||||
|
||||
|
||||
it('should clear commandStack after import', function(done) {
|
||||
|
||||
// given
|
||||
var xml = fs.readFileSync('test/fixtures/bpmn/simple.bpmn', 'utf8');
|
||||
|
||||
var diagram = createDiagram();
|
||||
|
||||
var commandStack = diagram.get('commandStack');
|
||||
|
||||
// when
|
||||
BpmnModel.fromXML(xml, function(err, definitions) {
|
||||
if (err) {
|
||||
return done(err);
|
||||
}
|
||||
|
||||
// when
|
||||
Importer.importBpmnDiagram(diagram, definitions, function(err) {
|
||||
expect(commandStack.getStack()).toEqual([]);
|
||||
|
||||
done(err);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
});
|
Loading…
Reference in New Issue