Add public getContainer API to TileLayer, and test for it.

This commit is contained in:
Tom MacWright 2013-02-19 20:05:44 -05:00
parent 0b14d71d7a
commit 8735b87980
2 changed files with 14 additions and 0 deletions

View File

@ -19,6 +19,16 @@ describe('TileLayer', function () {
expect(map.getMinZoom()).toBe(minZoom);
});
});
describe("accessing a tilelayer's properties", function () {
it('provides a container', function () {
map.setView([0, 0], 1);
var layer = L.tileLayer("{z}{x}{y}").addTo(map);
expect(layer.getContainer()).toBeTruthy();
});
});
describe("when a tilelayer is added to a map that already has a tilelayer", function () {
it("has its zoomlevels updated to fit the new layer", function () {
map.setView([0, 0], 1);

View File

@ -122,6 +122,10 @@ L.TileLayer = L.Class.extend({
return this.options.attribution;
},
getContainer: function () {
return this._container;
},
setOpacity: function (opacity) {
this.options.opacity = opacity;