Skip to content

Commit c227992

Browse files
monferaetpinard
authored andcommitted
test: handle trace with no points, resulting in invisible trace and node3 undefined
1 parent ca3b4f4 commit c227992

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/traces/choropleth/select.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ module.exports = function selectPoints(searchInfo, polygon) {
4747
}
4848

4949
if(node3) {
50-
node3.selectAll('path').style('opacity', function (d) {
50+
node3.selectAll('path').style('opacity', function(d) {
5151
return d.dim ? DESELECTDIM : 1;
5252
});
5353
}

test/jasmine/tests/select_test.js

+6
Original file line numberDiff line numberDiff line change
@@ -716,6 +716,12 @@ describe('Test select box and lasso per trace:', function() {
716716
fig.layout.geo.scope = 'europe';
717717
addInvisible(fig, false);
718718

719+
// add a trace with no locations which will then make trace invisible, lacking DOM elements
720+
fig.data.push(Lib.extendDeep({}, fig.data[0]));
721+
fig.data[1].text = [];
722+
fig.data[1].locations = [];
723+
fig.data[1].z = [];
724+
719725
Plotly.plot(gd, fig)
720726
.then(function() {
721727
return _run(

0 commit comments

Comments
 (0)