Script and makefile adjustments for updating extlib
[larjonas-mediagoblin.git] / extlib / leaflet / spec / suites / geo / LatLngSpec.js
bloba7498e71f02a87dc533f582ef0f11606997f6e40
1 describe('LatLng', function() {
2 describe('constructor', function() {
3 it("should set lat and lng", function() {
4 var a = new L.LatLng(25, 74);
5 expect(a.lat).toEqual(25);
6 expect(a.lng).toEqual(74);
8 var a = new L.LatLng(-25, -74);
9 expect(a.lat).toEqual(-25);
10 expect(a.lng).toEqual(-74);
11 });
13 it("should clamp latitude to lie between -90 and 90", function() {
14 var a = new L.LatLng(150, 0).lat;
15 expect(a).toEqual(90);
17 var b = new L.LatLng(-230, 0).lat;
18 expect(b).toEqual(-90);
19 });
21 it("should clamp longtitude to lie between -180 and 180", function() {
22 var a = new L.LatLng(0, 190).lng;
23 expect(a).toEqual(-170);
25 var b = new L.LatLng(0, 360).lng;
26 expect(b).toEqual(0);
28 var c = new L.LatLng(0, 380).lng;
29 expect(c).toEqual(20);
31 var d = new L.LatLng(0, -190).lng;
32 expect(d).toEqual(170);
34 var e = new L.LatLng(0, -360).lng;
35 expect(e).toEqual(0);
37 var f = new L.LatLng(0, -380).lng;
38 expect(f).toEqual(-20);
39 });
41 it("should not clamp latitude and longtitude if unbounded flag set to true", function() {
42 var a = new L.LatLng(150, 0, true).lat;
43 expect(a).toEqual(150);
45 var b = new L.LatLng(-230, 0, true).lat;
46 expect(b).toEqual(-230);
48 var c = new L.LatLng(0, 250, true).lng;
49 expect(c).toEqual(250);
51 var d = new L.LatLng(0, -190, true).lng;
52 expect(d).toEqual(-190);
53 });
54 });
56 describe('#equals', function() {
57 it("should return true if compared objects are equal within a certain margin", function() {
58 var a = new L.LatLng(10, 20);
59 var b = new L.LatLng(10 + 1.0E-10, 20 - 1.0E-10);
60 expect(a.equals(b)).toBe(true);
61 });
63 it("should return false if compared objects are not equal within a certain margin", function() {
64 var a = new L.LatLng(10, 20);
65 var b = new L.LatLng(10, 23.3);
66 expect(a.equals(b)).toBe(false);
67 });
68 });
69 });