Fix whitespace
This commit is contained in:
parent
bba4f2ae1b
commit
bee90ce0e5
@ -76,17 +76,15 @@ describe("Map", function () {
|
|||||||
describe("#setView", function () {
|
describe("#setView", function () {
|
||||||
it("sets the view of the map", function () {
|
it("sets the view of the map", function () {
|
||||||
expect(map.setView([51.505, -0.09], 13)).toBe(map);
|
expect(map.setView([51.505, -0.09], 13)).toBe(map);
|
||||||
expect(map.getZoom()).toBe(13);
|
expect(map.getZoom()).toBe(13);
|
||||||
|
expect(map.getCenter().distanceTo([51.505, -0.09])).toBeLessThan(5);
|
||||||
expect(map.getCenter().distanceTo([51.505, -0.09])).toBeLessThan(5);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("#getBounds", function () {
|
describe("#getBounds", function () {
|
||||||
it("is safe to call from within a moveend callback during initial " +
|
it("is safe to call from within a moveend callback during initial load (#1027)", function () {
|
||||||
"load (#1027)", function () {
|
|
||||||
map.on("moveend", function () {
|
map.on("moveend", function () {
|
||||||
map.getBounds();
|
map.getBounds();
|
||||||
});
|
});
|
||||||
|
|
||||||
map.setView([51.505, -0.09], 13);
|
map.setView([51.505, -0.09], 13);
|
||||||
@ -94,15 +92,14 @@ describe("Map", function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe("#getMinZoom and #getMaxZoom", function () {
|
describe("#getMinZoom and #getMaxZoom", function () {
|
||||||
it("The minZoom and maxZoom options overrides any" +
|
it("minZoom and maxZoom options overrides any minZoom and maxZoom set on layers", function () {
|
||||||
" minZoom and maxZoom set on layers", function () {
|
var c = document.createElement('div'),
|
||||||
var c = document.createElement('div'),
|
map = L.map(c, { minZoom: 5, maxZoom: 10 });
|
||||||
map = L.map(c, { minZoom: 5, maxZoom: 10 });
|
L.tileLayer("{z}{x}{y}", { minZoom:0, maxZoom: 10 }).addTo(map);
|
||||||
L.tileLayer("{z}{x}{y}", { minZoom:0, maxZoom: 10 }).addTo(map);
|
L.tileLayer("{z}{x}{y}", { minZoom:5, maxZoom: 15 }).addTo(map);
|
||||||
L.tileLayer("{z}{x}{y}", { minZoom:5, maxZoom: 15 }).addTo(map);
|
expect(map.getMinZoom()).toBe(5);
|
||||||
expect(map.getMinZoom()).toBe(5);
|
expect(map.getMaxZoom()).toBe(10);
|
||||||
expect(map.getMaxZoom()).toBe(10);
|
});
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("#addLayer", function () {
|
describe("#addLayer", function () {
|
||||||
@ -114,69 +111,64 @@ describe("Map", function () {
|
|||||||
expect(spy).toHaveBeenCalled();
|
expect(spy).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("when a new layer with greater zoomlevel coverage than the current layer is added to a map", function () {
|
describe("when a new layer with greater zoomlevel coverage than the current layer is added to a map", function () {
|
||||||
it("fires a zoomlevelschange event ",
|
it("fires a zoomlevelschange event", function () {
|
||||||
function () {
|
L.tileLayer("{z}{x}{y}", { minZoom:0, maxZoom: 10 }).addTo(map);
|
||||||
L.tileLayer("{z}{x}{y}", { minZoom:0, maxZoom: 10 }).addTo(map);
|
map.on("zoomlevelschange", spy);
|
||||||
map.on("zoomlevelschange", spy);
|
expect(spy).not.toHaveBeenCalled();
|
||||||
expect(spy).not.toHaveBeenCalled();
|
L.tileLayer("{z}{x}{y}", { minZoom:0, maxZoom: 15 }).addTo(map);
|
||||||
L.tileLayer("{z}{x}{y}", { minZoom:0, maxZoom: 15 }).addTo(map);
|
expect(spy).toHaveBeenCalled();
|
||||||
expect(spy).toHaveBeenCalled();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
describe("when a new layer with the same or lower zoomlevel coverage as the current layer is added to a map", function () {
|
|
||||||
it("fires no a zoomlevelschange event ",
|
|
||||||
function () {
|
|
||||||
L.tileLayer("{z}{x}{y}", { minZoom:0, maxZoom: 10 }).addTo(map);
|
|
||||||
map.on("zoomlevelschange", spy);
|
|
||||||
expect(spy).not.toHaveBeenCalled();
|
|
||||||
L.tileLayer("{z}{x}{y}", { minZoom:0, maxZoom: 10 }).addTo(map);
|
|
||||||
expect(spy).not.toHaveBeenCalled();
|
|
||||||
L.tileLayer("{z}{x}{y}", { minZoom:0, maxZoom: 5 }).addTo(map);
|
|
||||||
expect(spy).not.toHaveBeenCalled();
|
|
||||||
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
||||||
describe("#removeLayer", function () {
|
|
||||||
describe("when the last tile layer on a map is removed", function () {
|
|
||||||
it("fires a zoomlevelschange event ", function () {
|
|
||||||
map.whenReady(function(){
|
|
||||||
var tl = L.tileLayer("{z}{x}{y}", { minZoom:0, maxZoom: 10 })
|
|
||||||
.addTo(map);
|
|
||||||
|
|
||||||
map.on("zoomlevelschange", spy);
|
|
||||||
expect(spy).not.toHaveBeenCalled();
|
|
||||||
map.removeLayer(tl);
|
|
||||||
expect(spy).toHaveBeenCalled();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
describe("when a tile layer is removed from a map and it had greater zoom level coverage than the remainding layer", function () {
|
|
||||||
it("fires a zoomlevelschange event ", function () {
|
|
||||||
map.whenReady(function(){
|
|
||||||
var tl = L.tileLayer("{z}{x}{y}", { minZoom:0, maxZoom: 10 })
|
|
||||||
.addTo(map),
|
|
||||||
t2 = L.tileLayer("{z}{x}{y}", { minZoom:0, maxZoom: 15 })
|
|
||||||
.addTo(map);
|
|
||||||
|
|
||||||
map.on("zoomlevelschange", spy);
|
|
||||||
expect(spy).not.toHaveBeenCalled();
|
|
||||||
map.removeLayer(t2);
|
|
||||||
expect(spy).toHaveBeenCalled();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
describe("when a tile layer is removed from a map it and it had lesser or the sa,e zoom level coverage as the remainding layer(s)", function () {
|
|
||||||
it("shouldn't fire a zoomlevelschange event ", function () {
|
describe("when a new layer with the same or lower zoomlevel coverage as the current layer is added to a map", function () {
|
||||||
|
it("fires no zoomlevelschange event", function () {
|
||||||
|
L.tileLayer("{z}{x}{y}", { minZoom:0, maxZoom: 10 }).addTo(map);
|
||||||
|
map.on("zoomlevelschange", spy);
|
||||||
|
expect(spy).not.toHaveBeenCalled();
|
||||||
|
L.tileLayer("{z}{x}{y}", { minZoom:0, maxZoom: 10 }).addTo(map);
|
||||||
|
expect(spy).not.toHaveBeenCalled();
|
||||||
|
L.tileLayer("{z}{x}{y}", { minZoom:0, maxZoom: 5 }).addTo(map);
|
||||||
|
expect(spy).not.toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("#removeLayer", function () {
|
||||||
|
describe("when the last tile layer on a map is removed", function () {
|
||||||
|
it("fires a zoomlevelschange event", function () {
|
||||||
map.whenReady(function(){
|
map.whenReady(function(){
|
||||||
var tl = L.tileLayer("{z}{x}{y}", { minZoom:0, maxZoom: 10 })
|
var tl = L.tileLayer("{z}{x}{y}", { minZoom:0, maxZoom: 10 }).addTo(map);
|
||||||
.addTo(map),
|
|
||||||
t2 = L.tileLayer("{z}{x}{y}", { minZoom:0, maxZoom: 10 })
|
map.on("zoomlevelschange", spy);
|
||||||
.addTo(map),
|
expect(spy).not.toHaveBeenCalled();
|
||||||
t3 = L.tileLayer("{z}{x}{y}", { minZoom:0, maxZoom: 5 })
|
map.removeLayer(tl);
|
||||||
.addTo(map);
|
expect(spy).toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("when a tile layer is removed from a map and it had greater zoom level coverage than the remainding layer", function () {
|
||||||
|
it("fires a zoomlevelschange event", function () {
|
||||||
|
map.whenReady(function(){
|
||||||
|
var tl = L.tileLayer("{z}{x}{y}", { minZoom:0, maxZoom: 10 }).addTo(map),
|
||||||
|
t2 = L.tileLayer("{z}{x}{y}", { minZoom:0, maxZoom: 15 }).addTo(map);
|
||||||
|
|
||||||
|
map.on("zoomlevelschange", spy);
|
||||||
|
expect(spy).not.toHaveBeenCalled();
|
||||||
|
map.removeLayer(t2);
|
||||||
|
expect(spy).toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("when a tile layer is removed from a map it and it had lesser or the sa,e zoom level coverage as the remainding layer(s)", function () {
|
||||||
|
it("fires no zoomlevelschange event", function () {
|
||||||
|
map.whenReady(function(){
|
||||||
|
var tl = L.tileLayer("{z}{x}{y}", { minZoom:0, maxZoom: 10 }).addTo(map),
|
||||||
|
t2 = L.tileLayer("{z}{x}{y}", { minZoom:0, maxZoom: 10 }).addTo(map),
|
||||||
|
t3 = L.tileLayer("{z}{x}{y}", { minZoom:0, maxZoom: 5 }).addTo(map);
|
||||||
|
|
||||||
map.on("zoomlevelschange", spy);
|
map.on("zoomlevelschange", spy);
|
||||||
expect(spy).not.toHaveBeenCalled();
|
expect(spy).not.toHaveBeenCalled();
|
||||||
@ -184,10 +176,8 @@ describe("Map", function () {
|
|||||||
expect(spy).not.toHaveBeenCalled();
|
expect(spy).not.toHaveBeenCalled();
|
||||||
map.removeLayer(t3);
|
map.removeLayer(t3);
|
||||||
expect(spy).not.toHaveBeenCalled();
|
expect(spy).not.toHaveBeenCalled();
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user