mirror of
https://github.com/symfony/ux-google-map.git
synced 2026-03-23 23:42:13 +01:00
[Map] Add Map::removeAll*() methods
This commit is contained in:
committed by
Hugo Alliaume
parent
1942ff472c
commit
3fd186f668
@@ -74,6 +74,16 @@ class GoogleRendererTest extends RendererTestCase
|
||||
->removeMarker('marker2'),
|
||||
];
|
||||
|
||||
yield 'with all markers removed with removeAllMarkers()' => [
|
||||
'renderer' => new GoogleRenderer(new StimulusHelper(null), new UxIconRenderer(null), apiKey: 'api_key'),
|
||||
'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 GoogleRenderer(new StimulusHelper(null), new UxIconRenderer(null), apiKey: 'api_key'),
|
||||
'map' => (new Map())
|
||||
@@ -94,6 +104,16 @@ class GoogleRendererTest 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'))),
|
||||
];
|
||||
|
||||
yield 'with all polygons removed with removeAllPolygons()' => [
|
||||
'renderer' => new GoogleRenderer(new StimulusHelper(null), new UxIconRenderer(null), apiKey: 'api_key'),
|
||||
'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 GoogleRenderer(new StimulusHelper(null), new UxIconRenderer(null), apiKey: 'api_key'),
|
||||
'map' => (new Map())
|
||||
@@ -103,6 +123,16 @@ class GoogleRendererTest 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: 'Polygon'))),
|
||||
];
|
||||
|
||||
yield 'with all polylines removed with removeAllPolylines()' => [
|
||||
'renderer' => new GoogleRenderer(new StimulusHelper(null), new UxIconRenderer(null), apiKey: 'api_key'),
|
||||
'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 GoogleRenderer(new StimulusHelper(null), new UxIconRenderer(null), apiKey: 'api_key'),
|
||||
'map' => (new Map())
|
||||
@@ -112,6 +142,16 @@ class GoogleRendererTest extends RendererTestCase
|
||||
->addCircle(new Circle(center: new Point(1.1, 2.2), radius: 1000, infoWindow: new InfoWindow(content: 'Circle'))),
|
||||
];
|
||||
|
||||
yield 'with all circles removed with removeAllCircles()' => [
|
||||
'renderer' => new GoogleRenderer(new StimulusHelper(null), new UxIconRenderer(null), apiKey: 'api_key'),
|
||||
'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 GoogleRenderer(new StimulusHelper(null), new UxIconRenderer(null), apiKey: 'api_key'),
|
||||
'map' => (new Map())
|
||||
@@ -121,6 +161,16 @@ class GoogleRendererTest extends RendererTestCase
|
||||
->addRectangle(new Rectangle(southWest: new Point(1.1, 2.2), northEast: new Point(3.3, 4.4), infoWindow: new InfoWindow(content: 'Rectangle'))),
|
||||
];
|
||||
|
||||
yield 'with all rectangles removed with removeAllRectangles()' => [
|
||||
'renderer' => new GoogleRenderer(new StimulusHelper(null), new UxIconRenderer(null), apiKey: 'api_key'),
|
||||
'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 'with controls enabled' => [
|
||||
'renderer' => new GoogleRenderer(new StimulusHelper(null), new UxIconRenderer(null), apiKey: 'api_key'),
|
||||
'map' => (new Map())
|
||||
|
||||
@@ -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-google-map--map"
|
||||
data-symfony--ux-google-map--map-provider-options-value="{"apiKey":"api_key"}"
|
||||
data-symfony--ux-google-map--map-center-value="{"lat":48.8566,"lng":2.3522}"
|
||||
data-symfony--ux-google-map--map-zoom-value="12"
|
||||
data-symfony--ux-google-map--map-fit-bounds-to-markers-value="false"
|
||||
data-symfony--ux-google-map--map-options-value="{"mapId":null,"gestureHandling":"auto","backgroundColor":null,"disableDoubleClickZoom":false,"zoomControlOptions":{"position":22},"mapTypeControlOptions":{"mapTypeIds":[],"position":14,"style":0},"streetViewControlOptions":{"position":22},"fullscreenControlOptions":{"position":20},"@provider":"google"}"
|
||||
data-symfony--ux-google-map--map-markers-value="[]"
|
||||
data-symfony--ux-google-map--map-polygons-value="[]"
|
||||
data-symfony--ux-google-map--map-polylines-value="[]"
|
||||
data-symfony--ux-google-map--map-circles-value="[]"
|
||||
data-symfony--ux-google-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-google-map--map"
|
||||
data-symfony--ux-google-map--map-provider-options-value="{"apiKey":"api_key"}"
|
||||
data-symfony--ux-google-map--map-center-value="{"lat":48.8566,"lng":2.3522}"
|
||||
data-symfony--ux-google-map--map-zoom-value="12"
|
||||
data-symfony--ux-google-map--map-fit-bounds-to-markers-value="false"
|
||||
data-symfony--ux-google-map--map-options-value="{"mapId":null,"gestureHandling":"auto","backgroundColor":null,"disableDoubleClickZoom":false,"zoomControlOptions":{"position":22},"mapTypeControlOptions":{"mapTypeIds":[],"position":14,"style":0},"streetViewControlOptions":{"position":22},"fullscreenControlOptions":{"position":20},"@provider":"google"}"
|
||||
data-symfony--ux-google-map--map-markers-value="[]"
|
||||
data-symfony--ux-google-map--map-polygons-value="[]"
|
||||
data-symfony--ux-google-map--map-polylines-value="[]"
|
||||
data-symfony--ux-google-map--map-circles-value="[]"
|
||||
data-symfony--ux-google-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-google-map--map"
|
||||
data-symfony--ux-google-map--map-provider-options-value="{"apiKey":"api_key"}"
|
||||
data-symfony--ux-google-map--map-center-value="{"lat":48.8566,"lng":2.3522}"
|
||||
data-symfony--ux-google-map--map-zoom-value="12"
|
||||
data-symfony--ux-google-map--map-fit-bounds-to-markers-value="false"
|
||||
data-symfony--ux-google-map--map-options-value="{"mapId":null,"gestureHandling":"auto","backgroundColor":null,"disableDoubleClickZoom":false,"zoomControlOptions":{"position":22},"mapTypeControlOptions":{"mapTypeIds":[],"position":14,"style":0},"streetViewControlOptions":{"position":22},"fullscreenControlOptions":{"position":20},"@provider":"google"}"
|
||||
data-symfony--ux-google-map--map-markers-value="[]"
|
||||
data-symfony--ux-google-map--map-polygons-value="[]"
|
||||
data-symfony--ux-google-map--map-polylines-value="[]"
|
||||
data-symfony--ux-google-map--map-circles-value="[]"
|
||||
data-symfony--ux-google-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-google-map--map"
|
||||
data-symfony--ux-google-map--map-provider-options-value="{"apiKey":"api_key"}"
|
||||
data-symfony--ux-google-map--map-center-value="{"lat":48.8566,"lng":2.3522}"
|
||||
data-symfony--ux-google-map--map-zoom-value="12"
|
||||
data-symfony--ux-google-map--map-fit-bounds-to-markers-value="false"
|
||||
data-symfony--ux-google-map--map-options-value="{"mapId":null,"gestureHandling":"auto","backgroundColor":null,"disableDoubleClickZoom":false,"zoomControlOptions":{"position":22},"mapTypeControlOptions":{"mapTypeIds":[],"position":14,"style":0},"streetViewControlOptions":{"position":22},"fullscreenControlOptions":{"position":20},"@provider":"google"}"
|
||||
data-symfony--ux-google-map--map-markers-value="[]"
|
||||
data-symfony--ux-google-map--map-polygons-value="[]"
|
||||
data-symfony--ux-google-map--map-polylines-value="[]"
|
||||
data-symfony--ux-google-map--map-circles-value="[]"
|
||||
data-symfony--ux-google-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-google-map--map"
|
||||
data-symfony--ux-google-map--map-provider-options-value="{"apiKey":"api_key"}"
|
||||
data-symfony--ux-google-map--map-center-value="{"lat":48.8566,"lng":2.3522}"
|
||||
data-symfony--ux-google-map--map-zoom-value="12"
|
||||
data-symfony--ux-google-map--map-fit-bounds-to-markers-value="false"
|
||||
data-symfony--ux-google-map--map-options-value="{"mapId":null,"gestureHandling":"auto","backgroundColor":null,"disableDoubleClickZoom":false,"zoomControlOptions":{"position":22},"mapTypeControlOptions":{"mapTypeIds":[],"position":14,"style":0},"streetViewControlOptions":{"position":22},"fullscreenControlOptions":{"position":20},"@provider":"google"}"
|
||||
data-symfony--ux-google-map--map-markers-value="[]"
|
||||
data-symfony--ux-google-map--map-polygons-value="[]"
|
||||
data-symfony--ux-google-map--map-polylines-value="[]"
|
||||
data-symfony--ux-google-map--map-circles-value="[]"
|
||||
data-symfony--ux-google-map--map-rectangles-value="[]"
|
||||
></div>
|
||||
Reference in New Issue
Block a user