Commit Graph

410 Commits

Author SHA1 Message Date
Gert Van Gool
9d6e6fcdf4 Fixes Layer.isPopupOpen when no popup is bound (#5106)
* Adds initial tests for L.Layer#popup

* Fixes Layer.isPopupOpen when no popup is bound

This fixes uncaught exception when checking whether a popup isOpen(),
when the layer has no popup bound to it.
2016-11-29 10:33:54 +01:00
Iván Sánchez Ortega
633182a836 Sanity check in LatLngBounds.contains (fixes #5132) (#5135) 2016-11-24 09:36:33 +01:00
Per Liedman
2253672051 Only collapse layer control if collapsed: true (#5131)
Close #5126
2016-11-23 10:49:59 +01:00
Julio Garcia
d303a7b681 Adding Unit Tests for minNativeZoom and maxNativeZoom 2016-11-18 15:45:23 +01:00
Iván Sánchez Ortega
4e979514c3 Add a 'sortLayers' option to L.Control.Layers (#4711)
* Add a 'sortLayers' option to L.Control.Layers

* Add a sortFunction option to L.Control.Layers

* Fix default sort function; modify test
2016-11-17 12:52:29 +01:00
Yohan Boniface
88d107ca96 Merge pull request #5087 from Leaflet/layers-collapse-alt
Always create L.Control.Layers as collapsed; expand if collapse option not set
2016-11-11 16:15:49 +01:00
Per Liedman
a656a0b9ec Add unit test 2016-11-11 15:54:05 +01:00
Iván Sánchez Ortega
8c22c4e385 Ensure zoom is within span when adding a layer with min/maxzoom, fixes #4915 (#4916)
* Ensure zoom is within span when adding a layer with min/maxzoom, fixes #4915.

* Add tests written by @theashyster

* Add tests to verify map's zoom is actually adjusted to layer's min/max
2016-11-11 10:46:31 +01:00
Iván Sánchez Ortega
fd78560036 L.GeoJSON.asFeature should pass through FeatureCollections (#5049)
* L.GeoJSON.asFeature should pass through FeatureCollections

* Add unit test to verify FeatureCollection toGeoJSON
2016-11-10 13:53:38 +01:00
ghybs
34dca3cfd9 Fix #5011 (canvas remove+add) (#5024)
Bug when using map option `preferCanvas: true` (canvas renderer for paths) and removing then adding back a vector within the same animation frame (typically in the same sequence, as done by Leaflet.markercluster at `"zoomend"` event, to remove layers and clusters outside visible bounds).
This commit clears the `_removed` flag from paths when they are added to the canvas.
Also added corresponding test suites.
2016-10-20 15:50:15 +03:00
Vladimir Agafonkin
fd8c2599ef fix icon url warnings in tests 2016-09-27 17:58:08 +03:00
Yohan Boniface
e28f7ae984 Do not fail when closing an interactive tooltip not yet added to the map (#4937) 2016-09-26 16:40:51 +03:00
Andris Nolendorfs
62fdf6f642 Fix handling of NaN in getScaleZoom (#4914)
* Fixed an issue when crs.zoom returns NaN in getScaleZoom

* Small documentation fixes
2016-09-15 09:46:53 +02:00
Iván Sánchez Ortega
63fd4edc76 wrap tileBounds if noWrap is false by @fyeah (#4908) 2016-09-12 16:59:21 +02:00
Per Liedman
ed1a612e6f Make paths insensitive to the order of its map's moveend handlers (#4855)
* Make Paths always update after renderer updates

Close #4851

* Add test

* Add docs for update event

* Remove listener when layer is removed
2016-08-31 17:58:46 +03:00
Per Liedman
017d29c4eb Just store array of listeners, count is no longer needed. (#4842)
* Just store array of listeners, count is no longer needed.

* Remove unused code
2016-08-25 17:23:58 +02:00
Yohan Boniface
7927708b40 Allow to create and open a tooltip without source (fix #4827) (#4836) 2016-08-25 15:29:20 +02:00
Per Liedman
cee8edeaf2 Fix listener removal even if an event is firing
Close #4840.
2016-08-25 15:20:51 +02:00
Per Liedman
59c6bb201c Use spies as listeners 2016-08-24 09:52:29 +02:00
Per Liedman
0c6dc2ce1e Make event firing reentrant
Close #4833
2016-08-24 09:26:53 +02:00
Iván Sánchez Ortega
e9957cfa02 Detect L.Icon.Default.imagePath using CSS. #4604, #3696, #4579 (#4605)
* CSS-based paths for L.Icon.Default. #4604, #3696, #4579

* Unit tests for default icons

* Make CSS icon path detection IE8-friendly

* Backwards compatibility for L.Icon.Default.imagePath override.

* Don't overwrite options
2016-08-22 16:40:03 +02:00
Steve
92baa9c73f Throw error on call to L.Polygon getCenter before map add (#4820)
* Throw error on call to L.Polygon getCenter before map add

References #4740

* add polyline handling, tests, and docstring
2016-08-15 17:01:41 +02:00
Iván Sánchez Ortega
09937e39b0 Add a _leaflet_id to the map container to fix #4806 (#4810) 2016-08-11 09:10:46 +02:00
Yohan Boniface
a0ee68558f Close non permanent tooltip on map click on touch (fix #4741) 2016-08-02 16:55:17 +02:00
Yohan Boniface
8047b0b7a9 Make sure we call event listeners in the order they are registered (fix #4743) (#4769) 2016-08-02 17:53:06 +03:00
Yohan Boniface
e746211be7 Better tooltip offset handling (fix #4772) (#4773)
- default offset is now [0, 0]
- both offset.x and offset.y are always honoured
- positive x always move the tooltip on the right
- positive y always move the tooltip on the bottom
2016-08-02 17:51:22 +03:00
Yohan Boniface
fc1dc96638 Allow to call bindTooltip on a layer not yet added to a map (fix #4778) (#4779) 2016-08-02 17:50:53 +03:00
Vladimir Agafonkin
94303a681b Merge pull request #3952 from Leaflet/label
Implement L.Label
2016-07-15 13:06:36 +03:00
Per Liedman
0bcfbdb537 Cleanup, tests and minor bug fixes for event system 2016-07-08 15:01:38 +02:00
Fabian Zeindl
0210071dad refactoring of events, it should be about 4 times faster now 2016-07-08 14:47:02 +02:00
Yohan Boniface
64ba1f7f95 Rename Label in Tooltip, PopupBase in DivOverlay 2016-07-08 13:51:18 +02:00
Yohan Boniface
fe3649f032 Default L.Label border and tip to white 2016-07-08 11:33:53 +02:00
Yohan Boniface
bd2616f901 Do not rely on options.draggable to compute draggableMoved (#4638)
One can enable dragging of a marker after it has been initialized
with draggable=false.
2016-07-08 11:22:54 +02:00
Yohan Boniface
f8221e09f7 We now load CSS in Phantom, so no need to skip those tests 2016-07-08 11:08:25 +02:00
Yohan Boniface
0dd58bd01f Merge branch 'master' into label 2016-07-08 11:07:22 +02:00
Yohan Boniface
5dfc3364d1 Allow to make screenshots in Phantomjs (#4705)
* Load CSS in PhantomJS

* Allow to take screenshot in PhantomJS while running tests

For that, one need to run this call:

    window.top.callPhantom({'render': 'screenshot.png'});

* Make PhantomJS serve images

* Bonus: those tests now passe in Phantom too

* Add helper to make screenshot in tests

	takeScreenshot();

or

	takeScreenshot('path/to/screenshot.png');
2016-07-08 11:05:12 +02:00
Yohan Boniface
d18d661837 More label tests
431579ce4a
needed to make them pass on Phantom
2016-07-02 23:02:48 +02:00
Yohan Boniface
2f4b97de19 Add support for "center" Label position 2016-07-02 10:52:04 +02:00
Yohan Boniface
14bfedf7ff Merge branch 'master' into label 2016-07-02 10:36:42 +02:00
Iván Sánchez Ortega
8cb745ce0a L.Evented.listens() returns false on removed event handlers, #4474 (#4476)
* Fix L.Evented.listens() on removed event handlers, #4474

* Fix bad unit tests for marker events

* Only check for listerners.length if listerners is actually defined
2016-07-01 11:14:22 +02:00
Per Liedman
01790eacda Ignore events if Draggable is disabled, fixing disabling drag on click in IE11 (#4479)
* Ingore events if Draggable is disabled
Close #3666.

* Add test for verifying fix to #3666
2016-06-27 16:16:03 -07:00
Iván Sánchez Ortega
b2d7cf110b Fix #4039: Use different L.Bounds for "marking as prunable" and loading tiles (#4650)
* Fix #4039: Use different L.Bounds for "marking as prunable" and loading tiles.

* configurable tile pruning tests

* using spy for testing load did not happen
2016-06-21 15:27:44 +02:00
Yohan Boniface
d8a6ad4010 Use proper Hand onStop callback instead of setTimeout in popup spec 2016-06-16 15:34:16 +02:00
Yohan Boniface
d1de37aa88 Fix broken sizeOption when L.point instance (#4636) 2016-06-10 15:36:07 +02:00
Yohan Boniface
95d5b59c5f Fix canvas not filtering click event after drag (#4493)
* Fix preclick not fired in canvas
* Do not add canvas layers to click event targets if just dragged (fix #4458)
2016-06-01 17:43:32 +03:00
Ray Hammond
72c4f986b1 Icon size x can now be initialised with a number (#4608)
Icon size x can now be initialised with a number. Fixes #3185
2016-06-01 17:24:24 +03:00
Jon Woyame
878a022897 Prevent map click when layer has popup (#4603)
* prevent map click when layer has popup

* add test cases for click events on Paths

* update test for Path popups to check popup is open
2016-05-29 22:01:16 +02:00
Per Liedman
fbc6265fb7 Fix when all listeners are removed during dispatch (#4555)
Close #4478.
2016-05-12 10:22:36 +02:00
Yohan Boniface
6e8ac31993 Fix setMaxBounds not resetting when passing null argument (#4494) 2016-05-09 15:12:51 +02:00
Iván Sánchez Ortega
cc3380f98e Tweaked values of getBoundsZoom unit tests (#4528) 2016-05-09 10:42:19 +02:00