should not throw error when fitting on empty data (#11620) (#11712)

This commit is contained in:
Thomas Neirynck 2017-05-10 17:46:54 -04:00 committed by GitHub
parent 62a5dc63bb
commit 0c3bb057e2
2 changed files with 15 additions and 1 deletions

View file

@ -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();
});
});
});

View file

@ -473,7 +473,7 @@ export class KibanaMap extends EventEmitter {
}
});
if (bounds) {
if (bounds && bounds.isValid()) {
this._leafletMap.fitBounds(bounds);
}
}