Skip to content

Commit

Permalink
should not throw error when fitting on empty data (elastic#11620)
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasneirynck authored and snide committed May 30, 2017
1 parent f778fb2 commit a0ec2bb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
14 changes: 14 additions & 0 deletions src/ui/public/vis_maps/__tests__/geohash_layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,20 @@ describe('kibana_map tests', function () {
});


it('should not throw when fitting on empty-data layer', function () {

const geohashLayer = new GeohashLayer({
type: 'FeatureCollection',
features: []
}, { 'mapType': 'Scaled Circle Markers' }, kibanaMap.getZoomLevel(), kibanaMap);
kibanaMap.addLayer(geohashLayer);

expect(() => {
kibanaMap.fitToData();
}).to.not.throwException();
});


});

});
Expand Down
2 changes: 1 addition & 1 deletion src/ui/public/vis_maps/kibana_map.js
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ export class KibanaMap extends EventEmitter {
}
});

if (bounds) {
if (bounds && bounds.isValid()) {
this._leafletMap.fitBounds(bounds);
}
}
Expand Down

0 comments on commit a0ec2bb

Please sign in to comment.