Skip to content

Commit 314fbe1

Browse files
committed
test: handle trace with no points, resulting in invisible trace and node3 undefined
1 parent 6d78036 commit 314fbe1

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
@@ -687,6 +687,12 @@ describe('Test select box and lasso per trace:', function() {
687687
fig.layout.dragmode = 'select';
688688
fig.layout.geo.scope = 'europe';
689689

690+
// add a trace with no locations which will then make trace invisible, lacking DOM elements
691+
fig.data.push(Lib.extendDeep({}, fig.data[0]));
692+
fig.data[1].text = [];
693+
fig.data[1].locations = [];
694+
fig.data[1].z = [];
695+
690696
Plotly.plot(gd, fig)
691697
.then(function() {
692698
return _run(

0 commit comments

Comments
 (0)