[Pkg-javascript-commits] [leaflet-markercluster] 356/479: Tests for adding an individual marker and having it now show up.

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

    Tests for adding an individual marker and having it now show up.
---
 spec/index.html             |  2 ++
 spec/suites/AddLayerSpec.js | 76 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 78 insertions(+)

diff --git a/spec/index.html b/spec/index.html
index 135f0f7..033f03c 100644
--- a/spec/index.html
+++ b/spec/index.html
@@ -28,7 +28,9 @@
 	<!-- spec files -->
 
 	<script type="text/javascript" src="suites/SpecHelper.js"></script>
+	
 	<script type="text/javascript" src="suites/LeafletSpec.js"></script>
+	<script type="text/javascript" src="suites/AddLayerSpec.js"></script>
 
 	
     <script>
diff --git a/spec/suites/AddLayerSpec.js b/spec/suites/AddLayerSpec.js
new file mode 100644
index 0000000..af82617
--- /dev/null
+++ b/spec/suites/AddLayerSpec.js
@@ -0,0 +1,76 @@
+describe('addLayer', function () {
+	var map, div;
+	beforeEach(function () {
+		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 () {
+		document.body.removeChild(div);
+	});
+	it('adds an individual marker that is added before the group is added to the map', function () {
+
+		var group = new L.MarkerClusterGroup();
+		var marker = new L.Marker([1.5, 1.5]);
+
+		group.addLayer(marker);
+		map.addLayer(group);
+
+		expect(marker._icon).to.not.be(undefined);
+		expect(marker._icon.parentNode).to.be(map._panes.markerPane);
+	});
+	it('adds an individual marker that is added after the group is added to the map', function () {
+
+		var group = new L.MarkerClusterGroup();
+		var marker = new L.Marker([1.5, 1.5]);
+
+		map.addLayer(group);
+		group.addLayer(marker);
+
+		expect(marker._icon).to.not.be(undefined);
+		expect(marker._icon.parentNode).to.be(map._panes.markerPane);
+	});
+	it('adds (using animations) an individual marker that is 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]);
+
+		map.addLayer(group);
+		group.addLayer(marker);
+
+		expect(marker._icon).to.not.be(undefined);
+		expect(marker._icon.parentNode).to.be(map._panes.markerPane);
+	});
+
+
+	it('does not add an individual marker that is too far away that is added before the group is added to the map', function () {
+
+		var group = new L.MarkerClusterGroup();
+		var marker = new L.Marker([3.5, 1.5]);
+
+		group.addLayer(marker);
+		map.addLayer(group);
+
+		expect(marker._icon).to.be(undefined);
+	});
+	it('does not add an individual marker that is too far away that is added after the group is added to the map', function () {
+
+		var group = new L.MarkerClusterGroup();
+		var marker = new L.Marker([3.5, 1.5]);
+
+		map.addLayer(group);
+		group.addLayer(marker);
+
+		expect(marker._icon).to.be(undefined);
+	});
+
+
+});

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