Merge pull request #3915 from betagouv/disable-map-tiles-during-tests

carte: disable tiles layer during tests
This commit is contained in:
Paul Chavard 2019-06-04 11:00:53 +02:00 committed by GitHub
commit d8ba8d72e0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -13,10 +13,13 @@ export function initMap(element, position, editable = false) {
scrollWheelZoom: false
}).setView([position.lat, position.lon], editable ? 18 : position.zoom);
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution:
'&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);
const loadTilesLayer = process.env.RAILS_ENV != 'test';
if (loadTilesLayer) {
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution:
'&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);
}
if (editable) {
const freeDraw = new FreeDraw({