[Pkg-javascript-commits] [leaflet-markercluster] 98/219: add spec for removing layers when the group is not on the map

Jonas Smedegaard dr at jones.dk
Sat May 7 09:39:15 UTC 2016


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

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

commit da64e04a1904c30e69a2cc2003a16db85244548e
Author: Egon Steiner <es at intermaps.com>
Date:   Tue Sep 22 13:37:33 2015 +0200

    add spec for removing layers when the group is not on the map
---
 spec/suites/removeLayersSpec.js | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/spec/suites/removeLayersSpec.js b/spec/suites/removeLayersSpec.js
index 8f24ecf..ef52d3e 100644
--- a/spec/suites/removeLayersSpec.js
+++ b/spec/suites/removeLayersSpec.js
@@ -41,6 +41,27 @@
 		expect(group.getLayers().length).to.be(0);
 	});
 
+	it('removes all the layer given to it even if the group is not on the map', function () {
+
+		var group = new L.MarkerClusterGroup();
+		var markers = [
+			new L.Marker([1.5, 1.5]),
+			new L.Marker([1.5, 1.5]),
+			new L.Marker([1.5, 1.5])
+		];
+
+		map.addLayer(group);
+		group.addLayers(markers);
+		map.removeLayer(group);
+		group.removeLayers(markers);
+		map.addLayer(group);
+
+		expect(group.hasLayer(markers[0])).to.be(false);
+		expect(group.hasLayer(markers[1])).to.be(false);
+		expect(group.hasLayer(markers[2])).to.be(false);
+
+		expect(group.getLayers().length).to.be(0);
+	});
 
 	it('doesnt break if we are spiderfied', function () {
 
@@ -72,4 +93,4 @@
 			expect(group._spiderfied).to.be(null);
 		});
 	});
-});
\ 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