diff --git a/spec/suites/RemoveLayerSpec.js b/spec/suites/RemoveLayerSpec.js index a3d8d88d5..7c6560041 100644 --- a/spec/suites/RemoveLayerSpec.js +++ b/spec/suites/RemoveLayerSpec.js @@ -1,6 +1,7 @@ describe('removeLayer', function () { - var map, div; + var map, div, clock; beforeEach(function () { + clock = sinon.useFakeTimers(); div = document.createElement('div'); div.style.width = '200px'; div.style.height = '200px'; @@ -14,6 +15,7 @@ ])); }); afterEach(function () { + clock.restore(); document.body.removeChild(div); }); @@ -98,4 +100,29 @@ expect(marker._icon).to.be(null); expect(marker2._icon.parentNode).to.be(map._panes.markerPane); }); + + it('removes a layer (with animation) that was added to it (after being on the map) that is shown in a cluster', function () { + + var group = new L.MarkerClusterGroup({ animateAddingMarkers: true }); + var marker = new L.Marker([1.5, 1.5]); + var marker2 = new L.Marker([1.5, 1.5]); + + map.addLayer(group); + group.addLayer(marker); + group.addLayer(marker2); + + //Run the the animation + clock.tick(1000); + + expect(marker._icon).to.be(null); + expect(marker2._icon).to.be(null); + + group.removeLayer(marker); + + //Run the the animation + clock.tick(1000); + + expect(marker._icon).to.be(null); + expect(marker2._icon.parentNode).to.be(map._panes.markerPane); + }); }); \ No newline at end of file