Automated test for #216

This commit is contained in:
danzel
2013-07-10 11:01:03 +12:00
parent 9ed6a4ff8f
commit 98e76b6c66
2 changed files with 39 additions and 0 deletions
+1
View File
@@ -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();
+38
View File
@@ -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);
});
});