Enable prefer-template linting rule and fix issues (#8587)

This commit is contained in:
Jon Koops
2022-10-16 23:58:24 +02:00
committed by GitHub
parent a939c11d89
commit c33a57ca3a
52 changed files with 158 additions and 173 deletions

View File

@ -1198,7 +1198,7 @@ describe("Map", function () {
beforeEach(function () {
container.style.height = "100px";
container.style.width = origWidth + "px";
container.style.width = `${origWidth}px`;
map.setView([0, 0], 0);
map.invalidateSize({pan: false});
clock = sinon.useFakeTimers();
@ -1209,38 +1209,38 @@ describe("Map", function () {
});
it("pans by the right amount when growing in 1px increments", function () {
container.style.width = (origWidth + 1) + "px";
container.style.width = `${origWidth + 1}px`;
map.invalidateSize();
expect(map._getMapPanePos().x).to.be(1);
container.style.width = (origWidth + 2) + "px";
container.style.width = `${origWidth + 2}px`;
map.invalidateSize();
expect(map._getMapPanePos().x).to.be(1);
container.style.width = (origWidth + 3) + "px";
container.style.width = `${origWidth + 3}px`;
map.invalidateSize();
expect(map._getMapPanePos().x).to.be(2);
});
it("pans by the right amount when shrinking in 1px increments", function () {
container.style.width = (origWidth - 1) + "px";
container.style.width = `${origWidth - 1}px`;
map.invalidateSize();
expect(map._getMapPanePos().x).to.be(0);
container.style.width = (origWidth - 2) + "px";
container.style.width = `${origWidth - 2}px`;
map.invalidateSize();
expect(map._getMapPanePos().x).to.be(-1);
container.style.width = (origWidth - 3) + "px";
container.style.width = `${origWidth - 3}px`;
map.invalidateSize();
expect(map._getMapPanePos().x).to.be(-1);
});
it("pans back to the original position after growing by an odd size and back", function () {
container.style.width = (origWidth + 5) + "px";
container.style.width = `${origWidth + 5}px`;
map.invalidateSize();
container.style.width = origWidth + "px";
container.style.width = `${origWidth}px`;
map.invalidateSize();
expect(map._getMapPanePos().x).to.be(0);
@ -1259,7 +1259,7 @@ describe("Map", function () {
var spy = sinon.spy();
map.on("move", spy);
container.style.width = (origWidth + 5) + "px";
container.style.width = `${origWidth + 5}px`;
map.invalidateSize();
expect(spy.called).to.be.ok();
@ -1269,7 +1269,7 @@ describe("Map", function () {
var spy = sinon.spy();
map.on("moveend", spy);
container.style.width = (origWidth + 5) + "px";
container.style.width = `${origWidth + 5}px`;
map.invalidateSize();
expect(spy.called).to.be.ok();
@ -1279,7 +1279,7 @@ describe("Map", function () {
var spy = sinon.spy();
map.on("moveend", spy);
container.style.width = (origWidth + 5) + "px";
container.style.width = `${origWidth + 5}px`;
map.invalidateSize({debounceMoveend: true});
expect(spy.called).not.to.be.ok();