feat(palette): select start event when creating sub process
* use autoSelect hint to only select start event after create Related to #1152
This commit is contained in:
parent
90ba2971a1
commit
1470d043ba
|
@ -86,7 +86,11 @@ PaletteProvider.prototype.getPaletteEntries = function(element) {
|
|||
parent: subProcess
|
||||
});
|
||||
|
||||
create.start(event, [ subProcess, startEvent ]);
|
||||
create.start(event, [ subProcess, startEvent ], {
|
||||
hints: {
|
||||
autoSelect: [ startEvent ]
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function createParticipant(event) {
|
||||
|
|
|
@ -13,6 +13,10 @@ import { createMoveEvent } from 'diagram-js/lib/features/mouse/Mouse';
|
|||
|
||||
import { is } from 'lib/util/ModelUtil';
|
||||
|
||||
import {
|
||||
createCanvasEvent as canvasEvent
|
||||
} from '../../../util/MockEvents';
|
||||
|
||||
import {
|
||||
query as domQuery,
|
||||
queryAll as domQueryAll
|
||||
|
@ -46,7 +50,7 @@ describe('features/palette', function() {
|
|||
|
||||
describe('sub process', function() {
|
||||
|
||||
it('should create sub process with start event', inject(function(dragging, palette) {
|
||||
it('should create sub process with start event', inject(function(dragging) {
|
||||
|
||||
// when
|
||||
triggerPaletteEntry('create.subprocess-expanded');
|
||||
|
@ -60,6 +64,28 @@ describe('features/palette', function() {
|
|||
expect(is(elements[1], 'bpmn:StartEvent')).to.be.true;
|
||||
}));
|
||||
|
||||
|
||||
it('should select start event', inject(function(canvas, dragging, selection) {
|
||||
|
||||
// given
|
||||
var rootElement = canvas.getRootElement(),
|
||||
rootGfx = canvas.getGraphics(rootElement);
|
||||
|
||||
triggerPaletteEntry('create.subprocess-expanded');
|
||||
|
||||
// when
|
||||
dragging.hover({ element: rootElement, gfx: rootGfx });
|
||||
|
||||
dragging.move(canvasEvent({ x: 100, y: 100 }));
|
||||
|
||||
// when
|
||||
dragging.end();
|
||||
|
||||
// then
|
||||
expect(selection.get()).to.have.length(1);
|
||||
expect(is(selection.get()[0], 'bpmn:StartEvent')).to.be.true;
|
||||
}));
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue