[Pkg-javascript-commits] [leaflet-markercluster] 396/479: More getBounds tests

Jonas Smedegaard dr at jones.dk
Thu Oct 16 16:01:01 UTC 2014


This is an automated email from the git hooks/post-receive script.

js pushed a commit to branch master
in repository leaflet-markercluster.

commit 8d1f51addad88f8d1a6afe2af9802cd20c01d609
Author: danzel <danzel at localhost.geek.nz>
Date:   Tue Jun 25 09:02:40 2013 +1200

    More getBounds tests
---
 spec/suites/getBoundsSpec.js | 125 ++++++++++++++++++++++++++-----------------
 1 file changed, 76 insertions(+), 49 deletions(-)

diff --git a/spec/suites/getBoundsSpec.js b/spec/suites/getBoundsSpec.js
index 72b28c7..b4976f9 100644
--- a/spec/suites/getBoundsSpec.js
+++ b/spec/suites/getBoundsSpec.js
@@ -1,4 +1,4 @@
-describe('adding non point data works', function() {
+describe('getBounds', function() {
 	var map, div;
 	beforeEach(function() {
 		div = document.createElement('div');
@@ -18,74 +18,101 @@
 	});
 
 	describe('polygon layer', function() {
-		describe('getBounds', function() {
-			it('returns the correct bounds before adding to the map', function() {
-				var group = new L.MarkerClusterGroup();
-				var polygon = new L.Polygon([[1.5, 1.5], [2.0, 1.5], [2.0, 2.0], [1.5, 2.0]]);
+		it('returns the correct bounds before adding to the map', function() {
+			var group = new L.MarkerClusterGroup();
+			var polygon = new L.Polygon([[1.5, 1.5], [2.0, 1.5], [2.0, 2.0], [1.5, 2.0]]);
 
-				group.addLayer(polygon);
+			group.addLayer(polygon);
 
-				expect(group.getBounds().equals(polygon.getBounds())).to.be(true);
-			});
+			expect(group.getBounds().equals(polygon.getBounds())).to.be(true);
+		});
 
-			it('returns the correct bounds after adding to the map after adding polygon', function() {
-				var group = new L.MarkerClusterGroup();
-				var polygon = new L.Polygon([[1.5, 1.5], [2.0, 1.5], [2.0, 2.0], [1.5, 2.0]]);
+		it('returns the correct bounds after adding to the map after adding polygon', function() {
+			var group = new L.MarkerClusterGroup();
+			var polygon = new L.Polygon([[1.5, 1.5], [2.0, 1.5], [2.0, 2.0], [1.5, 2.0]]);
 
-				group.addLayer(polygon);
-				map.addLayer(group);
+			group.addLayer(polygon);
+			map.addLayer(group);
 
-				expect(group.getBounds().equals(polygon.getBounds())).to.be(true);
-			});
+			expect(group.getBounds().equals(polygon.getBounds())).to.be(true);
+		});
 
-			it('returns the correct bounds after adding to the map before adding polygon', function() {
-				var group = new L.MarkerClusterGroup();
-				var polygon = new L.Polygon([[1.5, 1.5], [2.0, 1.5], [2.0, 2.0], [1.5, 2.0]]);
+		it('returns the correct bounds after adding to the map before adding polygon', function() {
+			var group = new L.MarkerClusterGroup();
+			var polygon = new L.Polygon([[1.5, 1.5], [2.0, 1.5], [2.0, 2.0], [1.5, 2.0]]);
 
-				map.addLayer(group);
-				group.addLayer(polygon);
+			map.addLayer(group);
+			group.addLayer(polygon);
 
-				expect(group.getBounds().equals(polygon.getBounds())).to.be(true);
-			});
+			expect(group.getBounds().equals(polygon.getBounds())).to.be(true);
 		});
 	});
 
 	describe('marker layers', function () {
-		describe('getBounds', function () {
-			it('returns the correct bounds before adding to the map', function () {
-				var group = new L.MarkerClusterGroup();
-				var marker = new L.Marker([1.5, 1.5]);
-				var marker2 = new L.Marker([1.0, 5.0]);
-				var marker3 = new L.Marker([6.0, 2.0]);
+		it('returns the correct bounds before adding to the map', function () {
+			var group = new L.MarkerClusterGroup();
+			var marker = new L.Marker([1.5, 1.5]);
+			var marker2 = new L.Marker([1.0, 5.0]);
+			var marker3 = new L.Marker([6.0, 2.0]);
 
-				group.addLayers([marker, marker2, marker3]);
+			group.addLayers([marker, marker2, marker3]);
 
-				expect(group.getBounds().equals(L.latLngBounds([1.0, 5.0], [6.0, 1.5]))).to.be(true);
-			});
+			expect(group.getBounds().equals(L.latLngBounds([1.0, 5.0], [6.0, 1.5]))).to.be(true);
+		});
 
-			it('returns the correct bounds after adding to the map after adding markers', function () {
-				var group = new L.MarkerClusterGroup();
-				var marker = new L.Marker([1.5, 1.5]);
-				var marker2 = new L.Marker([1.0, 5.0]);
-				var marker3 = new L.Marker([6.0, 2.0]);
+		it('returns the correct bounds after adding to the map after adding markers', function () {
+			var group = new L.MarkerClusterGroup();
+			var marker = new L.Marker([1.5, 1.5]);
+			var marker2 = new L.Marker([1.0, 5.0]);
+			var marker3 = new L.Marker([6.0, 2.0]);
 
-				group.addLayers([marker, marker2, marker3]);
-				map.addLayer(group);
+			group.addLayers([marker, marker2, marker3]);
+			map.addLayer(group);
+
+			expect(group.getBounds().equals(L.latLngBounds([1.0, 5.0], [6.0, 1.5]))).to.be(true);
+		});
 
-				expect(group.getBounds().equals(L.latLngBounds([1.0, 5.0], [6.0, 1.5]))).to.be(true);
-			});
+		it('returns the correct bounds after adding to the map before adding markers', function () {
+			var group = new L.MarkerClusterGroup();
+			var marker = new L.Marker([1.5, 1.5]);
+			var marker2 = new L.Marker([1.0, 5.0]);
+			var marker3 = new L.Marker([6.0, 2.0]);
+
+			map.addLayer(group);
+			group.addLayers([marker, marker2, marker3]);
+
+			expect(group.getBounds().equals(L.latLngBounds([1.0, 5.0], [6.0, 1.5]))).to.be(true);
+		});
+	});
 
-			it('returns the correct bounds after adding to the map before adding markers', function () {
-				var group = new L.MarkerClusterGroup();
-				var marker = new L.Marker([1.5, 1.5]);
-				var marker2 = new L.Marker([1.0, 5.0]);
-				var marker3 = new L.Marker([6.0, 2.0]);
+	describe('marker and polygon layers', function() {
+		it('returns the correct bounds before adding to the map', function() {
+			var group = new L.MarkerClusterGroup();
+			var marker = new L.Marker([6.0, 3.0]);
+			var polygon = new L.Polygon([[1.5, 1.5], [2.0, 1.5], [2.0, 2.0], [1.5, 2.0]]);
+
+			group.addLayers([marker, polygon]);
+
+			expect(group.getBounds().equals(L.latLngBounds([1.5, 1.5], [6.0, 3.0]))).to.be(true);
+		});
+
+		it('returns the correct bounds after adding to the map', function () {
+			var group = new L.MarkerClusterGroup();
+			var marker = new L.Marker([6.0, 3.0]);
+			var polygon = new L.Polygon([[1.5, 1.5], [2.0, 1.5], [2.0, 2.0], [1.5, 2.0]]);
+
+			map.addLayer(group);
+			group.addLayers([marker, polygon]);
+
+			expect(group.getBounds().equals(L.latLngBounds([1.5, 1.5], [6.0, 3.0]))).to.be(true);
+		});
+	});
 
-				map.addLayer(group);
-				group.addLayers([marker, marker2, marker3]);
+	describe('blank layer', function () {
+		it('returns a blank bounds', function () {
+			var group = new L.MarkerClusterGroup();
 
-				expect(group.getBounds().equals(L.latLngBounds([1.0, 5.0], [6.0, 1.5]))).to.be(true);
-			});
+			expect(group.getBounds().isValid()).to.be(false);
 		});
 	});
 });
\ No newline at end of file

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/leaflet-markercluster.git



More information about the Pkg-javascript-commits mailing list