Leaflet/spec
ghybs 9e4f79d1e5 Fix(#5328): Layers Control can now become scrollable even if collapsed: false (#5348)
* Fix(#5328): Layers Control scrollable even if collapsed: false

the `expand()` method was called only when expanding the Layers Control through user action.
In the case of option `collapsed: false`, no event listener is attached (no user action expected to expand), therefore the control height is no longer adjusted compared to map container's height, whereas the only time it is done is at initialization, when the control is not yet inserted into the DOM, hence it does not have an actual height to check against.
Therefore added a hook on `addTo()` in order to run `expand()` AFTER the control has been insterted into the DOM.
The same issue happens when later adding more base layers / overlays to the Layers Control: it not collapsed, we should run again the height check (e.g. through the `expand()` method) to make sure we make it scrollable if necessary.
Therefore called `expand()` after each `_addLayer()`.
Actually checking first if the control is on map and if option `collapsed: false` in order to prevent calling `expand()` for nothing.

* Test(ControlLayers): 2 tests for collapsed: false being scrollable

(for issue #5328).
CAUTION: unlike most other tests, had to actually insert the map container into the DOM (i.e. `document.body`) for these tests to be useful, otherwise the height remains at 0.
This may lead to memory leak and tests hanging if done on too many tests (see Leaflet.markercluster tests issue, e.g. https://github.com/Leaflet/Leaflet.markercluster/pull/577)
2017-02-21 14:33:01 +01:00
..
suites Fix(#5328): Layers Control can now become scrollable even if collapsed: false (#5348) 2017-02-21 14:33:01 +01:00
.eslintrc Allow to make screenshots in Phantomjs (#4705) 2016-07-08 11:05:12 +02:00
after.js fix icon url warnings in tests 2016-09-27 17:58:08 +03:00
expect.js Use mocha 2013-04-03 14:50:09 -07:00
index.html Do not stop keypress on escape if no popup is open 2017-02-14 13:15:50 +01:00
karma.conf.js ES2015 modules: Add index.js files to subdirectories/namespace (#5329) 2017-02-13 14:14:00 +01:00
sinon.js Use mocha 2013-04-03 14:50:09 -07:00