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:
parent
00294e2994
commit
9b0f82dd47
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -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);
|
||||||
|
}
|
Loading…
Reference in New Issue