test: add test for map stop (#8369) (#8581)

This commit is contained in:
Victor Patru
2022-10-16 20:17:22 +03:00
committed by GitHub
parent 7105013e38
commit a939c11d89

View File

@ -275,6 +275,31 @@ describe("Map", function () {
});
});
describe("#stop", function () {
it("does not try to stop the animation if it wasn't set before", function () {
map.setView([50, 50], 10);
map.stop = sinon.spy();
map.panTo([10, 10], 10);
expect(map.stop.called).to.not.be.ok();
});
it("stops the execution of the flyTo animation", function () {
map.setView([0, 0]);
map.stop = sinon.spy();
map.flyTo([51.505, -0.09]);
map.stop();
expect(map.stop.calledOnce).to.be.ok();
});
it("stops the execution of the panTo animation", function () {
map.setView([0, 0]);
map.stop = sinon.spy();
map.panTo([51.505, -0.09]);
map.stop();
expect(map.stop.calledOnce).to.be.ok();
});
});
describe("#setZoomAround", function () {
beforeEach(function () {
map.setView([0, 0], 0); // loads map