Skip to content

Commit

Permalink
feat(palette): declare start event as to be selected
Browse files Browse the repository at this point in the history
* Uses new hints on create start to declare start event as the element to be selected after operation
  • Loading branch information
Niklas Kiefer committed Aug 8, 2019
1 parent 2dd483b commit 592be29
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
8 changes: 7 additions & 1 deletion lib/features/palette/PaletteProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,13 @@ PaletteProvider.prototype.getPaletteEntries = function(element) {
parent: subProcess
});

create.start(event, [ subProcess, startEvent ]);
var hints = {
selectOnFinish: [ startEvent ]
};

create.start(event, [ subProcess, startEvent ], {
hints: hints
});
}

function createParticipant(event) {
Expand Down
21 changes: 20 additions & 1 deletion test/spec/features/palette/PaletteProviderSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,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');
Expand All @@ -60,6 +60,25 @@ describe('features/palette', function() {
expect(is(elements[1], 'bpmn:StartEvent')).to.be.true;
}));


it('should declare start event to be selected', inject(function(dragging) {

// when
triggerPaletteEntry('create.subprocess-expanded');

// then
var context = dragging.context(),
data = context.data,
elements = data.elements,
createContext = data.context,
hints = createContext.hints,
selectOnFinish = hints.selectOnFinish;

expect(hints.selectOnFinish).to.exist;
expect(hints.selectOnFinish).to.have.length(1);
expect(selectOnFinish[0]).to.eql(elements[1]);
}));

});

});
Expand Down

0 comments on commit 592be29

Please sign in to comment.