[Pkg-javascript-commits] [leaflet-markercluster] 366/479: Test for removing with animation

Jonas Smedegaard dr at jones.dk
Thu Oct 16 16:00:51 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 a34aaa610db57ed9d6fbc6a5bf154442a176b1fe
Author: danzel <danzel at localhost.geek.nz>
Date:   Fri Jun 14 16:22:10 2013 +1200

    Test for removing with animation
---
 spec/suites/RemoveLayerSpec.js | 29 ++++++++++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)

diff --git a/spec/suites/RemoveLayerSpec.js b/spec/suites/RemoveLayerSpec.js
index a3d8d88..7c65600 100644
--- a/spec/suites/RemoveLayerSpec.js
+++ b/spec/suites/RemoveLayerSpec.js
@@ -1,6 +1,7 @@
 describe('removeLayer', function () {
-	var map, div;
+	var map, div, clock;
 	beforeEach(function () {
+		clock = sinon.useFakeTimers();
 		div = document.createElement('div');
 		div.style.width = '200px';
 		div.style.height = '200px';
@@ -14,6 +15,7 @@
 		]));
 	});
 	afterEach(function () {
+		clock.restore();
 		document.body.removeChild(div);
 	});
 
@@ -98,4 +100,29 @@
 		expect(marker._icon).to.be(null);
 		expect(marker2._icon.parentNode).to.be(map._panes.markerPane);
 	});
+
+	it('removes a layer (with animation) that was added to it (after being on the map) that is shown in a cluster', function () {
+
+		var group = new L.MarkerClusterGroup({ animateAddingMarkers: true });
+		var marker = new L.Marker([1.5, 1.5]);
+		var marker2 = new L.Marker([1.5, 1.5]);
+
+		map.addLayer(group);
+		group.addLayer(marker);
+		group.addLayer(marker2);
+
+		//Run the the animation
+		clock.tick(1000);
+
+		expect(marker._icon).to.be(null);
+		expect(marker2._icon).to.be(null);
+
+		group.removeLayer(marker);
+
+		//Run the the animation
+		clock.tick(1000);
+
+		expect(marker._icon).to.be(null);
+		expect(marker2._icon.parentNode).to.be(map._panes.markerPane);
+	});
 });
\ 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