bpmn-js/test/spec/features/modeling/behavior/RemoveEmbeddedLabelBoundsBehaviorSpec.js
Valentin Serra 390031a7c3 feat: update/remove embedded label bounds on shape moved/resized
* update embedded label bounds on shape move
* remove embedded label bounds on shape resize

Related to https: //github.com/camunda/camunda-modeler/issues/2591

Co-Authored-By: Martin Stamm <martin.stamm@camunda.com>
Co-Authored-By: Philipp Fromme <philippfromme@outlook.com>
2022-02-10 12:13:56 +01:00

72 lines
1.3 KiB
JavaScript

import {
bootstrapModeler,
inject
} from 'test/TestHelper';
import coreModule from 'lib/core';
import modelingModule from 'lib/features/modeling';
import { getDi } from 'lib/util/ModelUtil';
describe('features/modeling - RemoveEmbeddedLabelBoundsBehavior', function() {
var processDiagramXML = require('./RemoveEmbeddedLabelBoundsBehavior.bpmn');
beforeEach(bootstrapModeler(processDiagramXML, {
modules: [
coreModule,
modelingModule
]
}));
var bounds,
di;
beforeEach(inject(function(elementRegistry, modeling) {
// given
var subProcess = elementRegistry.get('Activity_1');
di = getDi(subProcess);
bounds = di.get('label').get('bounds');
// when
modeling.resizeShape(subProcess, {
x: 0,
y: 0,
width: 100,
height: 100
});
}));
it('<do>', function() {
// then
expect(di.get('label').get('bounds')).not.to.exist;
});
it('<undo>', inject(function(commandStack) {
// when
commandStack.undo();
// then
expect(di.get('label').get('bounds')).to.equal(bounds);
}));
it('<redo>', inject(function(commandStack) {
// when
commandStack.undo();
commandStack.redo();
// then
expect(di.get('label').get('bounds')).not.to.exist;
}));
});