carte: disable tiles layer during tests
During integration tests, we don't want to load the tiles from OSM: - It hits OSM servers during every test run; - It it slow (Capybara waits for the tiles to be loaded to proceed); - It makes test time out when tiles cannot be loaded for some reason. Fix #3913
This commit is contained in:
parent
c7cde75b53
commit
f2f16e2580
1 changed files with 7 additions and 4 deletions
|
@ -13,10 +13,13 @@ export function initMap(element, position, editable = false) {
|
||||||
scrollWheelZoom: false
|
scrollWheelZoom: false
|
||||||
}).setView([position.lat, position.lon], editable ? 18 : position.zoom);
|
}).setView([position.lat, position.lon], editable ? 18 : position.zoom);
|
||||||
|
|
||||||
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
const loadTilesLayer = process.env.RAILS_ENV != 'test';
|
||||||
attribution:
|
if (loadTilesLayer) {
|
||||||
'© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
|
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||||
}).addTo(map);
|
attribution:
|
||||||
|
'© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
|
||||||
|
}).addTo(map);
|
||||||
|
}
|
||||||
|
|
||||||
if (editable) {
|
if (editable) {
|
||||||
const freeDraw = new FreeDraw({
|
const freeDraw = new FreeDraw({
|
||||||
|
|
Loading…
Add table
Reference in a new issue