mirror of
https://github.com/Leaflet/Leaflet.git
synced 2025-07-25 15:38:54 +00:00
Make latLngBounds factory return an empty bounds with not argument
Just like the constructor. Fix #3408
This commit is contained in:
@ -17,6 +17,17 @@ describe('LatLngBounds', function () {
|
|||||||
expect(b).to.eql(a);
|
expect(b).to.eql(a);
|
||||||
expect(b.getNorthWest()).to.eql(new L.LatLng(30, 12));
|
expect(b.getNorthWest()).to.eql(new L.LatLng(30, 12));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('returns an empty bounds when not argument is given', function () {
|
||||||
|
var bounds = new L.LatLngBounds();
|
||||||
|
expect(bounds instanceof L.LatLngBounds).to.be.ok(a);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('returns an empty bounds when not argument is given to factory', function () {
|
||||||
|
var bounds = L.latLngBounds();
|
||||||
|
expect(bounds instanceof L.LatLngBounds).to.be.ok(a);
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('#extend', function () {
|
describe('#extend', function () {
|
||||||
|
@ -168,7 +168,7 @@ L.LatLngBounds.prototype = {
|
|||||||
// TODO International date line?
|
// TODO International date line?
|
||||||
|
|
||||||
L.latLngBounds = function (a, b) { // (LatLngBounds) or (LatLng, LatLng)
|
L.latLngBounds = function (a, b) { // (LatLngBounds) or (LatLng, LatLng)
|
||||||
if (!a || a instanceof L.LatLngBounds) {
|
if (a instanceof L.LatLngBounds) {
|
||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
return new L.LatLngBounds(a, b);
|
return new L.LatLngBounds(a, b);
|
||||||
|
Reference in New Issue
Block a user