Test for removing with animation

This commit is contained in:
danzel
2013-06-14 16:22:10 +12:00
parent 58fe4615ce
commit a34aaa610d
+28 -1
View File
@@ -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);
});
});