[Pkg-javascript-commits] [leaflet-markercluster] 404/479: Basic tests for spiderfy

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 1c82702a57480a48afeb6130c9d3afbc4883728d
Author: danzel <danzel at localhost.geek.nz>
Date:   Fri Jul 5 11:28:25 2013 +1200

    Basic tests for spiderfy
---
 spec/index.html             |  1 +
 spec/suites/spiderfySpec.js | 70 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 71 insertions(+)

diff --git a/spec/index.html b/spec/index.html
index 035626f..1e14838 100644
--- a/spec/index.html
+++ b/spec/index.html
@@ -49,6 +49,7 @@
 	<script type="text/javascript" src="suites/NonPointSpec.js"></script>
 
 	<script type="text/javascript" src="suites/RemoveLayerSpec.js"></script>
+	<script type="text/javascript" src="suites/spiderfySpec.js"></script>
 
 	<script>
 		(window.mochaPhantomJS || window.mocha).run();
diff --git a/spec/suites/spiderfySpec.js b/spec/suites/spiderfySpec.js
new file mode 100644
index 0000000..a6080d5
--- /dev/null
+++ b/spec/suites/spiderfySpec.js
@@ -0,0 +1,70 @@
+describe('spiderfy', function () {
+	var map, div, clock;
+	beforeEach(function () {
+		clock = sinon.useFakeTimers();
+
+		div = document.createElement('div');
+		div.style.width = '200px';
+		div.style.height = '200px';
+		document.body.appendChild(div);
+
+		map = L.map(div, { maxZoom: 18 });
+
+		map.fitBounds(new L.LatLngBounds([
+			[1, 1],
+			[2, 2]
+		]));
+	});
+	afterEach(function () {
+		clock.restore();
+		document.body.removeChild(div);
+	});
+
+	it('Spiderfies 2 Markers', function () {
+
+		var group = new L.MarkerClusterGroup();
+		var marker = new L.Marker([1.5, 1.5]);
+		var marker2 = new L.Marker([1.5, 1.5]);
+
+		group.addLayer(marker);
+		group.addLayer(marker2);
+		map.addLayer(group);
+
+		marker.__parent.spiderfy();
+
+		expect(marker._icon.parentNode).to.be(map._panes.markerPane);
+		expect(marker2._icon.parentNode).to.be(map._panes.markerPane);
+	});
+
+	it('Spiderfies 2 CircleMarkers', function () {
+
+		var group = new L.MarkerClusterGroup();
+		var marker = new L.CircleMarker([1.5, 1.5]);
+		var marker2 = new L.CircleMarker([1.5, 1.5]);
+
+		group.addLayer(marker);
+		group.addLayer(marker2);
+		map.addLayer(group);
+
+		marker.__parent.spiderfy();
+
+		expect(marker._container.parentNode).to.be(map._pathRoot);
+		expect(marker2._container.parentNode).to.be(map._pathRoot);
+	});
+
+	it('Spiderfies 2 Circles', function () {
+
+		var group = new L.MarkerClusterGroup();
+		var marker = new L.Circle([1.5, 1.5], 10);
+		var marker2 = new L.Circle([1.5, 1.5], 10);
+
+		group.addLayer(marker);
+		group.addLayer(marker2);
+		map.addLayer(group);
+
+		marker.__parent.spiderfy();
+
+		expect(marker._container.parentNode).to.be(map._pathRoot);
+		expect(marker2._container.parentNode).to.be(map._pathRoot);
+	});
+});
\ 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