update LatLng specs after removing default clamping/wrapping
This commit is contained in:
parent
624bcb8687
commit
8350bb1e08
@ -9,54 +9,6 @@ describe('LatLng', function() {
|
||||
expect(a.lat).toEqual(-25);
|
||||
expect(a.lng).toEqual(-74);
|
||||
});
|
||||
|
||||
it("should clamp latitude to lie between -90 and 90", function() {
|
||||
var a = new L.LatLng(150, 0).lat;
|
||||
expect(a).toEqual(90);
|
||||
|
||||
var b = new L.LatLng(-230, 0).lat;
|
||||
expect(b).toEqual(-90);
|
||||
});
|
||||
|
||||
it("should clamp longitude to lie between -180 and 180", function() {
|
||||
var a = new L.LatLng(0, 190).lng;
|
||||
expect(a).toEqual(-170);
|
||||
|
||||
var b = new L.LatLng(0, 360).lng;
|
||||
expect(b).toEqual(0);
|
||||
|
||||
var c = new L.LatLng(0, 380).lng;
|
||||
expect(c).toEqual(20);
|
||||
|
||||
var d = new L.LatLng(0, -190).lng;
|
||||
expect(d).toEqual(170);
|
||||
|
||||
var e = new L.LatLng(0, -360).lng;
|
||||
expect(e).toEqual(0);
|
||||
|
||||
var f = new L.LatLng(0, -380).lng;
|
||||
expect(f).toEqual(-20);
|
||||
|
||||
var g = new L.LatLng(0, 90).lng;
|
||||
expect(g).toEqual(90);
|
||||
|
||||
var h = new L.LatLng(0, 180).lng;
|
||||
expect(h).toEqual(180);
|
||||
});
|
||||
|
||||
it("should not clamp latitude and longitude if unbounded flag set to true", function() {
|
||||
var a = new L.LatLng(150, 0, true).lat;
|
||||
expect(a).toEqual(150);
|
||||
|
||||
var b = new L.LatLng(-230, 0, true).lat;
|
||||
expect(b).toEqual(-230);
|
||||
|
||||
var c = new L.LatLng(0, 250, true).lng;
|
||||
expect(c).toEqual(250);
|
||||
|
||||
var d = new L.LatLng(0, -190, true).lng;
|
||||
expect(d).toEqual(-190);
|
||||
});
|
||||
});
|
||||
|
||||
describe('#equals', function() {
|
||||
@ -72,5 +24,39 @@ describe('LatLng', function() {
|
||||
expect(a.equals(b)).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('#wrap', function () {
|
||||
it("#wrap should wrap longitude to lie between -180 and 180 by default", function() {
|
||||
var a = new L.LatLng(0, 190).wrap().lng;
|
||||
expect(a).toEqual(-170);
|
||||
|
||||
var b = new L.LatLng(0, 360).wrap().lng;
|
||||
expect(b).toEqual(0);
|
||||
|
||||
var c = new L.LatLng(0, 380).wrap().lng;
|
||||
expect(c).toEqual(20);
|
||||
|
||||
var d = new L.LatLng(0, -190).wrap().lng;
|
||||
expect(d).toEqual(170);
|
||||
|
||||
var e = new L.LatLng(0, -360).wrap().lng;
|
||||
expect(e).toEqual(0);
|
||||
|
||||
var f = new L.LatLng(0, -380).wrap().lng;
|
||||
expect(f).toEqual(-20);
|
||||
|
||||
var g = new L.LatLng(0, 90).wrap().lng;
|
||||
expect(g).toEqual(90);
|
||||
|
||||
var h = new L.LatLng(0, 180).wrap().lng;
|
||||
expect(h).toEqual(180);
|
||||
});
|
||||
|
||||
it("#wrap should wrap longitude within the given range", function() {
|
||||
var a = new L.LatLng(0, 190).wrap(-100, 100).lng;
|
||||
expect(a).toEqual(-10);
|
||||
});
|
||||
|
||||
})
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user