[Pkg-javascript-commits] [leaflet-markercluster] 26/128: Add test from calvinmetcalf in #397

Jonas Smedegaard dr at jones.dk
Sun Apr 16 06:26:00 UTC 2017


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

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

commit 1b68284d8fcd8574ee46fa2839b238d47af25271
Author: danzel <danzel at localhost.geek.nz>
Date:   Tue Dec 22 11:07:58 2015 +1300

    Add test from calvinmetcalf in #397
---
 spec/suites/removeLayersSpec.js | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/spec/suites/removeLayersSpec.js b/spec/suites/removeLayersSpec.js
index ef52d3e..f4caff6 100644
--- a/spec/suites/removeLayersSpec.js
+++ b/spec/suites/removeLayersSpec.js
@@ -41,6 +41,30 @@
 		expect(group.getLayers().length).to.be(0);
 	});
 
+	it('removes all the layer given to it even though they move', function () {
+
+		var group = new L.MarkerClusterGroup();
+		var markers = [
+			new L.Marker([10, 10]),
+			new L.Marker([20, 20]),
+			new L.Marker([30, 30])
+		];
+		var len = markers.length;
+		map.addLayer(group);
+
+		group.addLayers(markers);
+
+		markers.forEach(function (marker) {
+			marker.setLatLng([1.5, 1.5]);
+			group.removeLayer(marker);
+			expect(group.getLayers().length).to.be(len - 1);
+			group.addLayer(marker);
+			expect(group.getLayers().length).to.be(len);
+		});
+
+		expect(group.getLayers().length).to.be(len);
+	});
+
 	it('removes all the layer given to it even if the group is not on the map', function () {
 
 		var group = new L.MarkerClusterGroup();

-- 
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