test(Map): set div width for getBoundsZoom parameter inside, Firefox (#6192)

* test(Map): set div width for getBoundsZoom inside

in particular Firefox has a different default width than PhantomJS, making the result different than the expected one. Wider container => can zoom higher to fit the specified bounds.

* docs(Map): getBoundsZoom add padding

3rd argument docstring.
This commit is contained in:
ghybs 2018-06-20 14:25:05 +04:00 committed by Iván Sánchez Ortega
parent faa2bd0dac
commit 8c3eaaf3e8
2 changed files with 2 additions and 1 deletions

View File

@ -224,6 +224,7 @@ describe("Map", function () {
it("respects the 'inside' parameter", function () { it("respects the 'inside' parameter", function () {
var container = map.getContainer(); var container = map.getContainer();
container.style.height = height; container.style.height = height;
container.style.width = '1024px'; // Make sure the width is defined for browsers other than PhantomJS (in particular Firefox).
document.body.appendChild(container); document.body.appendChild(container);
expect(map.getBoundsZoom(wideBounds, false, padding)).to.be.equal(17); expect(map.getBoundsZoom(wideBounds, false, padding)).to.be.equal(17);
expect(map.getBoundsZoom(wideBounds, true, padding)).to.be.equal(20); expect(map.getBoundsZoom(wideBounds, true, padding)).to.be.equal(20);

View File

@ -820,7 +820,7 @@ export var Map = Evented.extend({
this.options.maxZoom; this.options.maxZoom;
}, },
// @method getBoundsZoom(bounds: LatLngBounds, inside?: Boolean): Number // @method getBoundsZoom(bounds: LatLngBounds, inside?: Boolean, padding?: Point): Number
// Returns the maximum zoom level on which the given bounds fit to the map // Returns the maximum zoom level on which the given bounds fit to the map
// view in its entirety. If `inside` (optional) is set to `true`, the method // view in its entirety. If `inside` (optional) is set to `true`, the method
// instead returns the minimum zoom level on which the map view fits into // instead returns the minimum zoom level on which the map view fits into