[Pkg-javascript-commits] [leaflet-markercluster] 363/479: Animation test for adding multiple markers with animations on

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 25bb880379387657a60af4b953ecefe3c08e1c59
Author: danzel <danzel at localhost.geek.nz>
Date:   Fri Jun 14 15:36:22 2013 +1200

    Animation test for adding multiple markers with animations on
---
 spec/suites/AddLayer.MultipleSpec.js | 28 +++++++++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)

diff --git a/spec/suites/AddLayer.MultipleSpec.js b/spec/suites/AddLayer.MultipleSpec.js
index 804484a..f2ab534 100644
--- a/spec/suites/AddLayer.MultipleSpec.js
+++ b/spec/suites/AddLayer.MultipleSpec.js
@@ -1,6 +1,8 @@
 describe('addLayer adding multiple markers', 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 +16,7 @@
 		]));
 	});
 	afterEach(function () {
+		clock.restore();
 		document.body.removeChild(div);
 	});
 
@@ -47,7 +50,30 @@
 
 		expect(map._panes.markerPane.childNodes.length).to.be(1);
 	});
+	it('creates a cluster with an animation when 2 overlapping markers are added after the group is added to the map', 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);
+
+		expect(marker._icon.parentNode).to.be(map._panes.markerPane);
+		expect(marker2._icon.parentNode).to.be(map._panes.markerPane);
+
+		expect(map._panes.markerPane.childNodes.length).to.be(3);
+
+		//Run the the animation
+		clock.tick(1000);
 
+		//Then markers should be removed from map
+		expect(marker._icon).to.be(null);
+		expect(marker2._icon).to.be(null);
+
+		expect(map._panes.markerPane.childNodes.length).to.be(1);
+	});
 
 	it('creates a cluster and marker when 2 overlapping markers and one non-overlapping are added before the group is added to the map', function () {
 

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