Merge pull request #1212 from moonlite/1178-zoomlevels-take2

Add test for ensuring maxZoom and minZoom on the map overrides any layer settings.
This commit is contained in:
Vladimir Agafonkin 2012-12-11 16:04:29 -08:00
commit 624bcb8687

View File

@ -10,7 +10,7 @@ describe("Map", function () {
map.setView([0, 0], 1);
expect(spy).toHaveBeenCalled();
})
});
});
describe("when the map has already been loaded", function () {
@ -27,7 +27,8 @@ describe("Map", function () {
});
describe("#getBounds", function () {
it("is safe to call from within a moveend callback during initial load (#1027)", function () {
it("is safe to call from within a moveend callback during initial "
+ "load (#1027)", function () {
var c = document.createElement('div'),
map = L.map(c);
@ -38,4 +39,16 @@ describe("Map", function () {
map.setView([51.505, -0.09], 13);
});
});
describe("#getMinZoom and #getMaxZoom", function () {
it("The minZoom and maxZoom options overrides any"
+ " minZoom and maxZoom set on layers", function () {
var c = document.createElement('div'),
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:5, maxZoom: 15 }).addTo(map);
expect(map.getMinZoom()).toBe(5);
expect(map.getMaxZoom()).toBe(10);
});
});
});