feat(hover-fix): fix hover

* fix start instead of source
This commit is contained in:
Philipp Fromme 2019-11-06 18:37:43 +01:00 committed by Nico Rehwaldt
parent ca53ab56bb
commit 1fa167088c
2 changed files with 9 additions and 13 deletions

View File

@ -66,8 +66,8 @@ export default function FixHoverBehavior(elementRegistry, eventBus, canvas) {
'bendpoint.move.hover'
], HIGH_PRIORITY, function(event) {
var context = event.context,
type = context.type,
hover = event.hover;
hover = event.hover,
type = context.type;
// ensure reconnect start/end on bpmn:Participant,
// not the underlying bpmn:Lane
@ -81,14 +81,13 @@ export default function FixHoverBehavior(elementRegistry, eventBus, canvas) {
eventBus.on([
'connect.start'
], HIGH_PRIORITY, function(event) {
var context = event.context,
source = context.source;
start = context.start;
// ensure connect start on bpmn:Participant,
// not the underlying bpmn:Lane
if (is(source, 'bpmn:Lane')) {
context.source = getLanesRoot(source) || source;
if (is(start, 'bpmn:Lane')) {
context.start = getLanesRoot(start) || start;
}
});

View File

@ -255,7 +255,7 @@ describe('features/modeling/behavior - fix hover', function() {
describe('reconnect', function() {
it('should set start to participant', inject(
it('should set hover to participant', inject(
function(bendpointMove, elementRegistry, eventBus, dragging) {
// given
@ -265,7 +265,7 @@ describe('features/modeling/behavior - fix hover', function() {
var messageFlow = elementRegistry.get('MessageFlow_2');
var connectSpy = spy(function(event) {
expect(event.context.target).to.eql(participant_lanes);
expect(event.context.hover).to.equal(participant_lanes);
});
eventBus.once('bendpoint.move.end', connectSpy);
@ -324,11 +324,7 @@ describe('features/modeling/behavior - fix hover', function() {
var lane_1 = elementRegistry.get('Lane_1');
var connectSpy = spy(function(event) {
var context = event.context,
source = context.source;
expect(source).to.eql(participant_lanes);
expect(event.context.source).to.eql(participant_lanes);
});
eventBus.once('connect.end', connectSpy);
@ -339,6 +335,7 @@ describe('features/modeling/behavior - fix hover', function() {
dragging.move(canvasEvent({ x: 240, y: 0 }));
dragging.hover(canvasEvent({ x: 240, y: 0 }, { element: participant_no_lanes }));
dragging.end();
// then