fix(palette): activate globalConnect tool instead of toggling

This prevents unwanted move events when triggered from the palette action.

Closes #1402
This commit is contained in:
Niklas Kiefer 2021-01-06 14:22:25 +01:00 committed by fake-join[bot]
parent 00294e2994
commit 9b0f82dd47
2 changed files with 29 additions and 1 deletions

View File

@ -134,7 +134,7 @@ PaletteProvider.prototype.getPaletteEntries = function(element) {
title: translate('Activate the global connect tool'), title: translate('Activate the global connect tool'),
action: { action: {
click: function(event) { click: function(event) {
globalConnect.toggle(event); globalConnect.start(event);
} }
} }
}, },

View File

@ -88,6 +88,30 @@ describe('features/palette', function() {
}); });
describe('tools', function() {
// skip on PhantomJS to prevent unwanted <forEach> behaviors
// cf. https://github.com/bpmn-io/diagram-js/pull/517
(isPhantomJS() ? it.skip : it)('should not fire <move> on globalConnect', inject(
function(eventBus) {
// given
var moveSpy = sinon.spy();
eventBus.on('global-connect.move', moveSpy);
// when
triggerPaletteEntry('global-connect-tool');
// then
expect(moveSpy).to.not.have.been.called;
}
));
});
}); });
// helpers ////////// // helpers //////////
@ -101,3 +125,7 @@ function triggerPaletteEntry(id) {
} }
}); });
} }
function isPhantomJS() {
return /PhantomJS/.test(window.navigator.userAgent);
}