Skip to content

Commit

Permalink
should not throw error when fitting on empty data (#11620) (#11710)
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasneirynck committed May 11, 2017
1 parent 29ceef6 commit 9fef931
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 @@ -473,7 +473,7 @@ class KibanaMap extends EventEmitter {
}
});

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

0 comments on commit 9fef931

Please sign in to comment.