[Pkg-javascript-commits] [leaflet-markercluster] 199/219: Add and fix tests from #421
Jonas Smedegaard
dr at jones.dk
Sat May 7 09:39:35 UTC 2016
This is an automated email from the git hooks/post-receive script.
js pushed a commit to branch master
in repository leaflet-markercluster.
commit 6a93ee3a191df3e4d75b75a199e85e6925736694
Author: danzel <danzel at localhost.geek.nz>
Date: Tue Dec 22 09:49:23 2015 +1300
Add and fix tests from #421
---
spec/suites/spiderfySpec.js | 52 +++++++++++++++++++++++++++++++++++++++++
src/MarkerCluster.Spiderfier.js | 3 ++-
2 files changed, 54 insertions(+), 1 deletion(-)
diff --git a/spec/suites/spiderfySpec.js b/spec/suites/spiderfySpec.js
index 9bd4bb7..b34e5a9 100644
--- a/spec/suites/spiderfySpec.js
+++ b/spec/suites/spiderfySpec.js
@@ -286,6 +286,58 @@
});
+ describe('spiderfied event listener', function () {
+ it('Spiderfies 2 Markers', function (done) {
+
+ 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);
+
+ // Add event listener
+ group.on('spiderfied', function (event) {
+ expect(event.target).to.be(group);
+ expect(event.cluster).to.be.a(L.Marker);
+ expect(event.markers[1]).to.be(marker);
+ expect(event.markers[0]).to.be(marker2);
+
+ done();
+ });
+
+ marker.__parent.spiderfy();
+
+ clock.tick(200);
+ });
+
+ it('Spiderfies 2 Circles', function (done) {
+
+ 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);
+
+ // Add event listener
+ group.on('spiderfied', function (event) {
+ expect(event.target).to.be(group);
+ expect(event.cluster).to.be.a(L.Marker);
+ expect(event.markers[1]).to.be(marker);
+ expect(event.markers[0]).to.be(marker2);
+
+ done();
+ });
+
+ marker.__parent.spiderfy();
+
+ clock.tick(200);
+ });
+ });
+
/////////////////////////////
// CLEAN UP CODE
diff --git a/src/MarkerCluster.Spiderfier.js b/src/MarkerCluster.Spiderfier.js
index 1d27018..1539ff9 100644
--- a/src/MarkerCluster.Spiderfier.js
+++ b/src/MarkerCluster.Spiderfier.js
@@ -163,7 +163,8 @@ L.MarkerClusterNonAnimated = L.MarkerCluster.extend({
L.MarkerCluster.include({
_animationSpiderfy: function (childMarkers, positions) {
- var group = this._group,
+ var me = this,
+ group = this._group,
map = group._map,
fg = group._featureGroup,
thisLayerLatLng = this._latlng,
--
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