Skip to content

Commit

Permalink
feat(hover-fix): fix hover
Browse files Browse the repository at this point in the history
* fix start instead of source
  • Loading branch information
philippfromme committed Nov 14, 2019
1 parent 0f7b8bc commit ea6e880
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
11 changes: 5 additions & 6 deletions lib/features/modeling/behavior/FixHoverBehavior.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
}
});

Expand Down
11 changes: 4 additions & 7 deletions test/spec/features/modeling/behavior/FixHoverBehaviorSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -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
Expand Down

0 comments on commit ea6e880

Please sign in to comment.