mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-27 08:02:51 +02:00
Test for removing with animation
This commit is contained in:
@@ -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);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user