mirror of
https://github.com/symfony/ux-leaflet-map.git
synced 2026-03-23 16:42:19 +01:00
[Map] Add Map::removeAll*() methods
This commit is contained in:
committed by
Hugo Alliaume
parent
cfcf0b95c0
commit
e0ca4e1a5e
@@ -69,6 +69,16 @@ class LeafletRendererTest extends RendererTestCase
|
||||
->removeMarker('marker2'),
|
||||
];
|
||||
|
||||
yield 'with all markers removed with removeAllMarkers()' => [
|
||||
'renderer' => new LeafletRenderer(new StimulusHelper(null), new UxIconRenderer(null)),
|
||||
'map' => (new Map())
|
||||
->center(new Point(48.8566, 2.3522))
|
||||
->zoom(12)
|
||||
->addMarker($marker1)
|
||||
->addMarker($marker2)
|
||||
->removeAllMarkers(),
|
||||
];
|
||||
|
||||
yield 'with marker remove and new ones added' => [
|
||||
'renderer' => new LeafletRenderer(new StimulusHelper(null), new UxIconRenderer(null)),
|
||||
'map' => (new Map())
|
||||
@@ -89,6 +99,16 @@ class LeafletRendererTest extends RendererTestCase
|
||||
->addPolygon(new Polygon(points: [new Point(1.1, 2.2), new Point(3.3, 4.4), new Point(5.5, 6.6)], infoWindow: new InfoWindow(content: 'Polygon'), id: 'polygon2')),
|
||||
];
|
||||
|
||||
yield 'with all polygons removed with removeAllPolygons()' => [
|
||||
'renderer' => new LeafletRenderer(new StimulusHelper(null), new UxIconRenderer(null)),
|
||||
'map' => (new Map())
|
||||
->center(new Point(48.8566, 2.3522))
|
||||
->zoom(12)
|
||||
->addPolygon(new Polygon(points: [new Point(48.8566, 2.3522), new Point(48.8566, 2.3522), new Point(48.8566, 2.3522)]))
|
||||
->addPolygon(new Polygon(points: [new Point(1.1, 2.2), new Point(3.3, 4.4), new Point(5.5, 6.6)], infoWindow: new InfoWindow(content: 'Polygon')))
|
||||
->removeAllPolygons(),
|
||||
];
|
||||
|
||||
yield 'with polylines and infoWindows' => [
|
||||
'renderer' => new LeafletRenderer(new StimulusHelper(null), new UxIconRenderer(null)),
|
||||
'map' => (new Map())
|
||||
@@ -98,6 +118,16 @@ class LeafletRendererTest extends RendererTestCase
|
||||
->addPolyline(new Polyline(points: [new Point(1.1, 2.2), new Point(3.3, 4.4), new Point(5.5, 6.6)], infoWindow: new InfoWindow(content: 'Polyline'), id: 'polyline2')),
|
||||
];
|
||||
|
||||
yield 'with all polylines removed with removeAllPolylines()' => [
|
||||
'renderer' => new LeafletRenderer(new StimulusHelper(null), new UxIconRenderer(null)),
|
||||
'map' => (new Map())
|
||||
->center(new Point(48.8566, 2.3522))
|
||||
->zoom(12)
|
||||
->addPolyline(new Polyline(points: [new Point(48.8566, 2.3522), new Point(48.8566, 2.3522), new Point(48.8566, 2.3522)]))
|
||||
->addPolyline(new Polyline(points: [new Point(1.1, 2.2), new Point(3.3, 4.4), new Point(5.5, 6.6)], infoWindow: new InfoWindow(content: 'Polyline')))
|
||||
->removeAllPolylines(),
|
||||
];
|
||||
|
||||
yield 'with circles and infoWindows' => [
|
||||
'renderer' => new LeafletRenderer(new StimulusHelper(null), new UxIconRenderer(null)),
|
||||
'map' => (new Map())
|
||||
@@ -107,6 +137,16 @@ class LeafletRendererTest extends RendererTestCase
|
||||
->addCircle(new Circle(center: new Point(1.1, 2.2), radius: 500, infoWindow: new InfoWindow(content: 'Circle'), id: 'circle2')),
|
||||
];
|
||||
|
||||
yield 'with all circles removed with removeAllCircles()' => [
|
||||
'renderer' => new LeafletRenderer(new StimulusHelper(null), new UxIconRenderer(null)),
|
||||
'map' => (new Map())
|
||||
->center(new Point(48.8566, 2.3522))
|
||||
->zoom(12)
|
||||
->addCircle(new Circle(center: new Point(48.8566, 2.3522), radius: 500, infoWindow: new InfoWindow(content: 'Circle')))
|
||||
->addCircle(new Circle(center: new Point(1.1, 2.2), radius: 1000, infoWindow: new InfoWindow(content: 'Circle')))
|
||||
->removeAllCircles(),
|
||||
];
|
||||
|
||||
yield 'with rectangles and infoWindows' => [
|
||||
'renderer' => new LeafletRenderer(new StimulusHelper(null), new UxIconRenderer(null)),
|
||||
'map' => (new Map())
|
||||
@@ -125,6 +165,16 @@ class LeafletRendererTest extends RendererTestCase
|
||||
)),
|
||||
];
|
||||
|
||||
yield 'with all rectangles removed with removeAllRectangles()' => [
|
||||
'renderer' => new LeafletRenderer(new StimulusHelper(null), new UxIconRenderer(null)),
|
||||
'map' => (new Map())
|
||||
->center(new Point(48.8566, 2.3522))
|
||||
->zoom(12)
|
||||
->addRectangle(new Rectangle(southWest: new Point(48.8566, 2.3522), northEast: new Point(48.8566, 2.3522), infoWindow: new InfoWindow(content: 'Rectangle')))
|
||||
->addRectangle(new Rectangle(southWest: new Point(1.1, 2.2), northEast: new Point(3.3, 4.4), infoWindow: new InfoWindow(content: 'Rectangle')))
|
||||
->removeAllRectangles(),
|
||||
];
|
||||
|
||||
yield 'markers with icons' => [
|
||||
'renderer' => new LeafletRenderer(
|
||||
new StimulusHelper(null),
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
<!-- This HTML has been prettified for testing purposes, and may not represent the actual HTML output.
|
||||
Run "php vendor/bin/phpunit -d --update-snapshots" to update the snapshot. -->
|
||||
<div
|
||||
data-controller="symfony--ux-leaflet-map--map"
|
||||
data-symfony--ux-leaflet-map--map-provider-options-value="{}"
|
||||
data-symfony--ux-leaflet-map--map-center-value="{"lat":48.8566,"lng":2.3522}"
|
||||
data-symfony--ux-leaflet-map--map-zoom-value="12"
|
||||
data-symfony--ux-leaflet-map--map-fit-bounds-to-markers-value="false"
|
||||
data-symfony--ux-leaflet-map--map-options-value="{"tileLayer":{"url":"https:\/\/tile.openstreetmap.org\/{z}\/{x}\/{y}.png","attribution":"\u00a9 <a href=\"https:\/\/www.openstreetmap.org\/copyright\">OpenStreetMap<\/a>","options":[]},"attributionControlOptions":{"position":"bottomright","prefix":"Leaflet"},"zoomControlOptions":{"position":"topleft","zoomInText":"<span aria-hidden=\"true\">+<\/span>","zoomInTitle":"Zoom in","zoomOutText":"<span aria-hidden=\"true\">&#x2212;<\/span>","zoomOutTitle":"Zoom out"},"@provider":"leaflet"}"
|
||||
data-symfony--ux-leaflet-map--map-markers-value="[]"
|
||||
data-symfony--ux-leaflet-map--map-polygons-value="[]"
|
||||
data-symfony--ux-leaflet-map--map-polylines-value="[]"
|
||||
data-symfony--ux-leaflet-map--map-circles-value="[]"
|
||||
data-symfony--ux-leaflet-map--map-rectangles-value="[]"
|
||||
></div>
|
||||
@@ -0,0 +1,15 @@
|
||||
<!-- This HTML has been prettified for testing purposes, and may not represent the actual HTML output.
|
||||
Run "php vendor/bin/phpunit -d --update-snapshots" to update the snapshot. -->
|
||||
<div
|
||||
data-controller="symfony--ux-leaflet-map--map"
|
||||
data-symfony--ux-leaflet-map--map-provider-options-value="{}"
|
||||
data-symfony--ux-leaflet-map--map-center-value="{"lat":48.8566,"lng":2.3522}"
|
||||
data-symfony--ux-leaflet-map--map-zoom-value="12"
|
||||
data-symfony--ux-leaflet-map--map-fit-bounds-to-markers-value="false"
|
||||
data-symfony--ux-leaflet-map--map-options-value="{"tileLayer":{"url":"https:\/\/tile.openstreetmap.org\/{z}\/{x}\/{y}.png","attribution":"\u00a9 <a href=\"https:\/\/www.openstreetmap.org\/copyright\">OpenStreetMap<\/a>","options":[]},"attributionControlOptions":{"position":"bottomright","prefix":"Leaflet"},"zoomControlOptions":{"position":"topleft","zoomInText":"<span aria-hidden=\"true\">+<\/span>","zoomInTitle":"Zoom in","zoomOutText":"<span aria-hidden=\"true\">&#x2212;<\/span>","zoomOutTitle":"Zoom out"},"@provider":"leaflet"}"
|
||||
data-symfony--ux-leaflet-map--map-markers-value="[]"
|
||||
data-symfony--ux-leaflet-map--map-polygons-value="[]"
|
||||
data-symfony--ux-leaflet-map--map-polylines-value="[]"
|
||||
data-symfony--ux-leaflet-map--map-circles-value="[]"
|
||||
data-symfony--ux-leaflet-map--map-rectangles-value="[]"
|
||||
></div>
|
||||
@@ -0,0 +1,15 @@
|
||||
<!-- This HTML has been prettified for testing purposes, and may not represent the actual HTML output.
|
||||
Run "php vendor/bin/phpunit -d --update-snapshots" to update the snapshot. -->
|
||||
<div
|
||||
data-controller="symfony--ux-leaflet-map--map"
|
||||
data-symfony--ux-leaflet-map--map-provider-options-value="{}"
|
||||
data-symfony--ux-leaflet-map--map-center-value="{"lat":48.8566,"lng":2.3522}"
|
||||
data-symfony--ux-leaflet-map--map-zoom-value="12"
|
||||
data-symfony--ux-leaflet-map--map-fit-bounds-to-markers-value="false"
|
||||
data-symfony--ux-leaflet-map--map-options-value="{"tileLayer":{"url":"https:\/\/tile.openstreetmap.org\/{z}\/{x}\/{y}.png","attribution":"\u00a9 <a href=\"https:\/\/www.openstreetmap.org\/copyright\">OpenStreetMap<\/a>","options":[]},"attributionControlOptions":{"position":"bottomright","prefix":"Leaflet"},"zoomControlOptions":{"position":"topleft","zoomInText":"<span aria-hidden=\"true\">+<\/span>","zoomInTitle":"Zoom in","zoomOutText":"<span aria-hidden=\"true\">&#x2212;<\/span>","zoomOutTitle":"Zoom out"},"@provider":"leaflet"}"
|
||||
data-symfony--ux-leaflet-map--map-markers-value="[]"
|
||||
data-symfony--ux-leaflet-map--map-polygons-value="[]"
|
||||
data-symfony--ux-leaflet-map--map-polylines-value="[]"
|
||||
data-symfony--ux-leaflet-map--map-circles-value="[]"
|
||||
data-symfony--ux-leaflet-map--map-rectangles-value="[]"
|
||||
></div>
|
||||
@@ -0,0 +1,15 @@
|
||||
<!-- This HTML has been prettified for testing purposes, and may not represent the actual HTML output.
|
||||
Run "php vendor/bin/phpunit -d --update-snapshots" to update the snapshot. -->
|
||||
<div
|
||||
data-controller="symfony--ux-leaflet-map--map"
|
||||
data-symfony--ux-leaflet-map--map-provider-options-value="{}"
|
||||
data-symfony--ux-leaflet-map--map-center-value="{"lat":48.8566,"lng":2.3522}"
|
||||
data-symfony--ux-leaflet-map--map-zoom-value="12"
|
||||
data-symfony--ux-leaflet-map--map-fit-bounds-to-markers-value="false"
|
||||
data-symfony--ux-leaflet-map--map-options-value="{"tileLayer":{"url":"https:\/\/tile.openstreetmap.org\/{z}\/{x}\/{y}.png","attribution":"\u00a9 <a href=\"https:\/\/www.openstreetmap.org\/copyright\">OpenStreetMap<\/a>","options":[]},"attributionControlOptions":{"position":"bottomright","prefix":"Leaflet"},"zoomControlOptions":{"position":"topleft","zoomInText":"<span aria-hidden=\"true\">+<\/span>","zoomInTitle":"Zoom in","zoomOutText":"<span aria-hidden=\"true\">&#x2212;<\/span>","zoomOutTitle":"Zoom out"},"@provider":"leaflet"}"
|
||||
data-symfony--ux-leaflet-map--map-markers-value="[]"
|
||||
data-symfony--ux-leaflet-map--map-polygons-value="[]"
|
||||
data-symfony--ux-leaflet-map--map-polylines-value="[]"
|
||||
data-symfony--ux-leaflet-map--map-circles-value="[]"
|
||||
data-symfony--ux-leaflet-map--map-rectangles-value="[]"
|
||||
></div>
|
||||
@@ -0,0 +1,15 @@
|
||||
<!-- This HTML has been prettified for testing purposes, and may not represent the actual HTML output.
|
||||
Run "php vendor/bin/phpunit -d --update-snapshots" to update the snapshot. -->
|
||||
<div
|
||||
data-controller="symfony--ux-leaflet-map--map"
|
||||
data-symfony--ux-leaflet-map--map-provider-options-value="{}"
|
||||
data-symfony--ux-leaflet-map--map-center-value="{"lat":48.8566,"lng":2.3522}"
|
||||
data-symfony--ux-leaflet-map--map-zoom-value="12"
|
||||
data-symfony--ux-leaflet-map--map-fit-bounds-to-markers-value="false"
|
||||
data-symfony--ux-leaflet-map--map-options-value="{"tileLayer":{"url":"https:\/\/tile.openstreetmap.org\/{z}\/{x}\/{y}.png","attribution":"\u00a9 <a href=\"https:\/\/www.openstreetmap.org\/copyright\">OpenStreetMap<\/a>","options":[]},"attributionControlOptions":{"position":"bottomright","prefix":"Leaflet"},"zoomControlOptions":{"position":"topleft","zoomInText":"<span aria-hidden=\"true\">+<\/span>","zoomInTitle":"Zoom in","zoomOutText":"<span aria-hidden=\"true\">&#x2212;<\/span>","zoomOutTitle":"Zoom out"},"@provider":"leaflet"}"
|
||||
data-symfony--ux-leaflet-map--map-markers-value="[]"
|
||||
data-symfony--ux-leaflet-map--map-polygons-value="[]"
|
||||
data-symfony--ux-leaflet-map--map-polylines-value="[]"
|
||||
data-symfony--ux-leaflet-map--map-circles-value="[]"
|
||||
data-symfony--ux-leaflet-map--map-rectangles-value="[]"
|
||||
></div>
|
||||
Reference in New Issue
Block a user