Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't try to call doneFnCompleted when it isn't set #3755

Merged
merged 2 commits into from
Apr 10, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions src/plots/cartesian/select.js
Original file line number Diff line number Diff line change
@@ -15,6 +15,7 @@ var Registry = require('../../registry');
var Color = require('../../components/color');
var Fx = require('../../components/fx');

var Lib = require('../../lib');
var polygon = require('../../lib/polygon');
var throttle = require('../../lib/throttle');
var makeEventData = require('../../components/fx/helpers').makeEventData;
@@ -49,8 +50,6 @@ function prepSelect(e, startX, startY, dragOptions, mode) {
var allAxes = dragOptions.xaxes.concat(dragOptions.yaxes);
var subtract = e.altKey;

var doneFnCompleted = dragOptions.doneFnCompleted;

var filterPoly, selectionTester, mergedPolygons, currentPolygon;
var i, searchInfo, eventData;

@@ -268,7 +267,7 @@ function prepSelect(e, startX, startY, dragOptions, mode) {
}

Fx.click(gd, evt);
});
}).catch(Lib.error);
};

dragOptions.doneFn = function() {
@@ -288,8 +287,10 @@ function prepSelect(e, startX, startY, dragOptions, mode) {
[].push.apply(dragOptions.mergedPolygons, mergedPolygons);
}

doneFnCompleted(selection);
});
if(dragOptions.doneFnCompleted) {
dragOptions.doneFnCompleted(selection);
}
}).catch(Lib.error);
};
}

2 changes: 2 additions & 0 deletions test/jasmine/tests/select_test.js
Original file line number Diff line number Diff line change
@@ -1597,6 +1597,7 @@ describe('Test select box and lasso per trace:', function() {

beforeEach(function() {
gd = createGraphDiv();
spyOn(Lib, 'error');
});

afterEach(destroyGraphDiv);
@@ -1716,6 +1717,7 @@ describe('Test select box and lasso per trace:', function() {
.then(eventCounts[2] ? deselectPromise : Promise.resolve())
.then(function() {
assertEventCounts(eventCounts[0], eventCounts[1], eventCounts[2], msg + ' (after dblclick)');
expect(Lib.error).not.toHaveBeenCalled();
});
}