[Pkg-javascript-commits] [leaflet-markercluster] 408/479: Automated test for #216
Jonas Smedegaard
dr at jones.dk
Thu Oct 16 16:01:02 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 98e76b6c662e23ea0a460f5c6a2ad168844bb4e9
Author: danzel <danzel at localhost.geek.nz>
Date: Wed Jul 10 11:01:03 2013 +1200
Automated test for #216
---
spec/index.html | 1 +
spec/suites/zoomAnimationSpec.js | 38 ++++++++++++++++++++++++++++++++++++++
2 files changed, 39 insertions(+)
diff --git a/spec/index.html b/spec/index.html
index 1e14838..519282b 100644
--- a/spec/index.html
+++ b/spec/index.html
@@ -50,6 +50,7 @@
<script type="text/javascript" src="suites/RemoveLayerSpec.js"></script>
<script type="text/javascript" src="suites/spiderfySpec.js"></script>
+ <script type="text/javascript" src="suites/zoomAnimationSpec.js"></script>
<script>
(window.mochaPhantomJS || window.mocha).run();
diff --git a/spec/suites/zoomAnimationSpec.js b/spec/suites/zoomAnimationSpec.js
new file mode 100644
index 0000000..42ccd34
--- /dev/null
+++ b/spec/suites/zoomAnimationSpec.js
@@ -0,0 +1,38 @@
+describe('eachLayer', 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, center: new L.LatLng(-37.36142550190516, 174.254150390625), zoom: 7 });
+ });
+ afterEach(function () {
+ clock.restore();
+
+ document.body.removeChild(div);
+ });
+
+ it('adds the marker to the map', function () {
+ var markers = new L.MarkerClusterGroup();
+ 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
+ map.addLayer(markers);
+
+ 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(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