[Pkg-javascript-commits] [leaflet-markercluster] 424/479: failing test case for #260 - marker doesn't appear after fitBounds
Jonas Smedegaard
dr at jones.dk
Thu Oct 16 16:01:04 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 bfecd7c64defaedab6f847a6f68e8b5b9e091410
Author: danzel <danzel at localhost.geek.nz>
Date: Mon Oct 14 09:42:05 2013 +1300
failing test case for #260 - marker doesn't appear after fitBounds
---
spec/suites/zoomAnimationSpec.js | 43 ++++++++++++++++++++++++++++++++--------
1 file changed, 35 insertions(+), 8 deletions(-)
diff --git a/spec/suites/zoomAnimationSpec.js b/spec/suites/zoomAnimationSpec.js
index 42ccd34..7fb8e29 100644
--- a/spec/suites/zoomAnimationSpec.js
+++ b/spec/suites/zoomAnimationSpec.js
@@ -1,4 +1,4 @@
-describe('eachLayer', function () {
+describe('zoomAnimation', function () {
var map, div, clock;
beforeEach(function () {
clock = sinon.useFakeTimers();
@@ -8,7 +8,7 @@
div.style.height = '200px';
document.body.appendChild(div);
- map = L.map(div, { maxZoom: 18, center: new L.LatLng(-37.36142550190516, 174.254150390625), zoom: 7 });
+ map = L.map(div, { maxZoom: 18 });
});
afterEach(function () {
clock.restore();
@@ -16,8 +16,14 @@
document.body.removeChild(div);
});
- it('adds the marker to the map', function () {
- var markers = new L.MarkerClusterGroup();
+ it('adds the visible marker to the map', function () {
+ map.setView(new L.LatLng(-37.36142550190516, 174.254150390625), 7);
+
+ var markers = new L.MarkerClusterGroup({
+ showCoverageOnHover: true,
+ maxClusterRadius: 20,
+ disableClusteringAtZoom: 15
+ });
var marker = new L.Marker([-37.77852090603777, 175.3103667497635]);
markers.addLayer(marker); //The one we zoom in on
markers.addLayer(new L.Marker([-37.711800591811055, 174.50034790039062])); //Marker that we cluster with at the top zoom level, but not 1 level down
@@ -25,14 +31,35 @@
clock.tick(1000);
map.setView([-37.77852090603777, 175.3103667497635], 15);
- //clock.tick(1000);
- //map.setView([-37.77852090603777, 175.3103667497635], 14);
- //clock.tick(1000);
- //map.setView([-37.77852090603777, 175.3103667497635], 15);
//Run the the animation
clock.tick(1000);
+ expect(marker._icon).to.not.be(undefined);
expect(marker._icon).to.not.be(null);
});
+
+ it('adds the visible marker to the map', function () {
+
+ var markers = new L.MarkerClusterGroup();
+ var marker1 = new L.Marker([48.858280181884766, 2.2945759296417236]);
+ var marker2 = new L.Marker([16.02359962463379, -61.70280075073242]);
+ markers.addLayer(marker1); //The one we zoom in on first
+ markers.addLayer(marker2); //Marker that we cluster with at the top zoom level, but not 1 level down
+ map.addLayer(markers);
+
+ //show the first
+ map.fitBounds(new L.LatLngBounds(new L.LatLng(41.371582, -5.142222), new L.LatLng(51.092804, 9.561556)));
+
+ clock.tick(1000);
+
+ map.fitBounds(new L.LatLngBounds(new L.LatLng(15.830972671508789, -61.807167053222656), new L.LatLng(16.516849517822266, -61.0)));
+
+ //Run the the animation
+ clock.tick(1000);
+
+ //Now the second one should be visible on the map
+ expect(marker2._icon).to.not.be(undefined);
+ expect(marker2._icon).to.not.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