test(copy-paste): assert elements.changed behavior

This commit is contained in:
Nico Rehwaldt 2019-12-01 11:37:56 +01:00 committed by Philipp Fromme
parent a1be2ea631
commit a66e9a5c8d
2 changed files with 2277 additions and 0 deletions

View File

@ -27,6 +27,8 @@ import {
is is
} from 'lib/util/ModelUtil'; } from 'lib/util/ModelUtil';
/* global sinon */
describe('features/copy-paste', function() { describe('features/copy-paste', function() {
@ -40,6 +42,7 @@ describe('features/copy-paste', function() {
var basicXML = require('./basic.bpmn'), var basicXML = require('./basic.bpmn'),
copyPropertiesXML = require('./copy-properties.bpmn'), copyPropertiesXML = require('./copy-properties.bpmn'),
propertiesXML = require('./properties.bpmn'), propertiesXML = require('./properties.bpmn'),
complexXML = require('./complex.bpmn'),
collaborationXML = require('./collaboration.bpmn'), collaborationXML = require('./collaboration.bpmn'),
collaborationMultipleXML = require('./collaboration-multiple.bpmn'), collaborationMultipleXML = require('./collaboration-multiple.bpmn'),
collaborationAssociationsXML = require('./data-associations.bpmn'), collaborationAssociationsXML = require('./data-associations.bpmn'),
@ -780,8 +783,54 @@ describe('features/copy-paste', function() {
])); ]));
}); });
describe('complex', function() {
beforeEach(bootstrapModeler(complexXML, {
modules: testModules,
moddleExtensions: {
camunda: camundaPackage
}
}));
it('should mark as changed', inject(
function(canvas, eventBus, copyPaste, elementRegistry, commandStack) {
// given
var participant = elementRegistry.get('sid-187453C6-5AB5-4A6D-9A62-BF537E04EA0D'),
rootElement = canvas.getRootElement();
var changedSpy = sinon.spy(function(event) {
expect(event.elements).to.have.length(56);
}); });
// when
eventBus.on('elements.changed', changedSpy);
copyPaste.copy([ participant ]);
copyPaste.paste({
element: rootElement,
point: {
x: 800,
y: 300
}
});
commandStack.undo();
commandStack.redo();
// then
expect(changedSpy).to.have.been.calledThrice;
}
));
});
});
// helpers ////////// // helpers //////////
/** /**

File diff suppressed because it is too large Load Diff