Skip to content

Commit

Permalink
Merge branch 'develop' into type-hints
Browse files Browse the repository at this point in the history
  • Loading branch information
nikku committed Apr 29, 2024
2 parents f4f87de + 4d0c0f4 commit 6fdde53
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 12 deletions.
9 changes: 4 additions & 5 deletions lib/features/context-pad/ContextPadProvider.js
Expand Up @@ -110,6 +110,10 @@ export default function ContextPadProvider(
entries.replace.action.click(event, shape);
}
});

eventBus.on('contextPad.close', function() {
appendPreview.cleanUp();
});
}

ContextPadProvider.$inject = [
Expand Down Expand Up @@ -244,16 +248,12 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
create.start(event, shape, {
source: element
});

appendPreview.cleanUp();
}

var append = autoPlace ? function(_, element) {
var shape = elementFactory.createShape(assign({ type: type }, options));

autoPlace.append(element, shape);

appendPreview.cleanUp();
} : appendStart;

var previewAppend = autoPlace ? function(_, element) {
Expand Down Expand Up @@ -487,7 +487,6 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
'bpmn-icon-text-annotation',
translate('Add text annotation')
),

'connect': {
group: 'connect',
className: 'bpmn-icon-connection-multi',
Expand Down
2 changes: 1 addition & 1 deletion lib/features/modeling/cmd/SetColorHandler.js
Expand Up @@ -52,7 +52,7 @@ export default function SetColorHandler(commandStack) {
}
}

throw new Error('invalid color value: ' + color);
throw new Error(`invalid color value: ${ color }`);
};
}

Expand Down
2 changes: 1 addition & 1 deletion lib/features/modeling/cmd/SplitLaneHandler.js
Expand Up @@ -41,7 +41,7 @@ SplitLaneHandler.prototype.preExecute = function(context) {
existingLanesCount = childLanes.length;

if (existingLanesCount > newLanesCount) {
throw new Error(`more than <${newLanesCount}> child lanes`);
throw new Error(`more than <${ newLanesCount }> child lanes`);
}

var isHorizontalLane = isHorizontal(shape);
Expand Down
4 changes: 2 additions & 2 deletions lib/features/ordering/BpmnOrderingProvider.js
Expand Up @@ -113,7 +113,7 @@ export default function BpmnOrderingProvider(eventBus, canvas) {
}

if (!order) {
throw new Error('no order for <' + element.id + '>');
throw new Error(`no order for <${ element.id }>`);
}

return order;
Expand All @@ -133,7 +133,7 @@ export default function BpmnOrderingProvider(eventBus, canvas) {
}

if (!actualParent) {
throw new Error('no parent for <' + element.id + '> in <' + (newParent && newParent.id) + '>');
throw new Error(`no parent for <${ element.id }> in <${ newParent && newParent.id }>`);
}

return actualParent;
Expand Down
2 changes: 1 addition & 1 deletion lib/import/BpmnTreeWalker.js
Expand Up @@ -80,7 +80,7 @@ export default function BpmnTreeWalker(handler) {
// avoid multiple rendering of elements
if (gfx) {
throw new Error(
'already rendered ${ elementToString(element) }'
`already rendered ${ elementToString(element) }`
);
}

Expand Down
2 changes: 1 addition & 1 deletion rollup.config.js
Expand Up @@ -131,7 +131,7 @@ function processTemplate(str, args) {
var replacement = args[n];

if (!replacement) {
throw new Error('unknown template {{ ' + n + '}}');
throw new Error(`unknown template {{ ${ n } }}`);
}

return replacement;
Expand Down
23 changes: 23 additions & 0 deletions test/spec/features/context-pad/ContextPadProviderSpec.js
Expand Up @@ -737,6 +737,29 @@ describe('features - context-pad', function() {
expect(domQueryAll('.djs-dragger', canvas.getLayer('complex-preview'))).to.have.length(2);
}));


it('should remove append preview on close', inject(function(canvas, elementRegistry, contextPad) {

// given
var element = elementRegistry.get('Task_1');

contextPad.open(element);

// mock event
var event = padEvent('append.gateway');

contextPad.trigger('hover', event);

expect(canvas.getLayer('complex-preview')).to.exist;
expect(domQueryAll('.djs-dragger', canvas.getLayer('complex-preview'))).to.have.length(2);

// when
contextPad.close();

// then
expect(domQueryAll('.djs-dragger', canvas.getLayer('complex-preview'))).to.have.length(0);
}));

});

});
Expand Down
2 changes: 1 addition & 1 deletion test/spec/features/ordering/Helper.js
Expand Up @@ -206,7 +206,7 @@ export function expectZOrder() {

if (next && compareZOrder(e, next) !== -1) {
throw new Error(
'expected <element#' + (next.id || next) + '> to be in front of <element#' + (e.id || e) + '>'
`expected <element#${ next.id || next }> to be in front of <element#${ e.id || e }>`
);
}
});
Expand Down

0 comments on commit 6fdde53

Please sign in to comment.