]> git.openstreetmap.org Git - rails.git/blobdiff - test/javascripts/osm_test.js
Move jquery.cookie to be a yarn managed asset
[rails.git] / test / javascripts / osm_test.js
index f26f08c9f4594de9043d6cb0eb5207c083a200db..83e7501978bb7a8b3c64bd44e7a1884c435ac515 100644 (file)
@@ -1,7 +1,7 @@
 //= require jquery
-//= require jquery.cookie
+//= require jquery.cookie/jquery.cookie
 //= require osm
-//= require leaflet
+//= require leaflet/dist/leaflet-src
 //= require leaflet.osm
 //= require leaflet.map
 //= require i18n/translations
@@ -239,4 +239,14 @@ describe("OSM", function () {
       expect(OSM.locationCookie(map)).to.eq("-3.685|57.625|5|M");
     });
   });
+
+  describe(".distance", function () {
+    it("computes distance between points", function () {
+      var latlng1 = L.latLng(51.76712,-0.00484),
+        latlng2 = L.latLng(51.7675159, -0.0078329);
+
+      expect(OSM.distance(latlng1, latlng2)).to.be.closeTo(210.664, 0.005);
+      expect(OSM.distance(latlng2, latlng1)).to.be.closeTo(210.664, 0.005);
+    });
+  });
 });