From a76c3f1ed46de7c67b1b46c147d0927bb3128125 Mon Sep 17 00:00:00 2001 From: "Renisha Christie. A" <29401459+crisner@users.noreply.github.com> Date: Fri, 24 Jan 2020 21:09:02 +0530 Subject: [PATCH] Fix build errors on lel version bump to 2.1.9 (#7340) * bump LEL to 2.1.9 * Increase wait time in map test * Add baselayer and comment out layers * copying in @VladimirMikulic's system test optimizations Co-authored-by: Jeffrey Warren --- app/views/map/map.html.erb | 7 +++++-- package.json | 2 +- test/system/map_test.rb | 29 ++++++++++++++++++++--------- yarn.lock | 17 +++++++++++++---- 4 files changed, 39 insertions(+), 16 deletions(-) diff --git a/app/views/map/map.html.erb b/app/views/map/map.html.erb index bcaa663d98..fad28eff6b 100644 --- a/app/views/map/map.html.erb +++ b/app/views/map/map.html.erb @@ -92,7 +92,7 @@ layersname = layersname.split(',') <% end %> - L.tileLayer( + var baseLayer = L.tileLayer( "https://a.tiles.mapbox.com/v3/jywarren.map-lmrwb2em/{z}/{x}/{y}.png", { attribution: '© OpenStreetMap contributors' @@ -101,7 +101,10 @@ L.LayerGroup.EnvironmentalLayers({ - include: layersname, + baseLayers: { + 'Gray-scale': baselayer + }, + // include: layersname, hash: false, embed: true, hostname: 'publiclab.org', diff --git a/package.json b/package.json index 3574b78704..74d5405439 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ "junction": "theleagueof/junction#*", "leaflet": "^1.6.0", "leaflet-blurred-location": "^1.6.0", - "leaflet-environmental-layers": "^2.1.7", + "leaflet-environmental-layers": "^2.1.9", "leaflet-hash": "^0.2.1", "leaflet-spin": "1.1.0", "leaflet.fullscreen": "1.6.0", diff --git a/test/system/map_test.rb b/test/system/map_test.rb index c9d254abdb..26ba2e2a4b 100644 --- a/test/system/map_test.rb +++ b/test/system/map_test.rb @@ -3,35 +3,46 @@ # https://guides.rubyonrails.org/testing.html#implementing-a-system-test class MapTest < ApplicationSystemTestCase - Capybara.default_max_wait_time = 90 + Capybara.default_max_wait_time = 60 test 'correct url hash for wiki map' do visit '/map/chicago' + url_hash = page.evaluate_script("window.location.hash") + + # Wait for any potential asynchronous operations to complete + wait_for_ajax + # check that the url hash is correct - assert_equal("#13/41.87/-87.64", page.evaluate_script("window.location.hash")) - + assert_equal("#13/41.87/-87.64", url_hash) end test 'show map by hash location' do visit '/map#9/-25/-13' lat = page.evaluate_script("Math.round(map.getCenter().lat)") - assert_equal(-25, lat) - assert_equal(-25, page.evaluate_script("Math.round(map.getCenter().lat)")) - assert_equal(-13, page.evaluate_script("Math.round(map.getCenter().lng)")) - assert_equal(9, page.evaluate_script("map.getZoom()")) + lng = page.evaluate_script("Math.round(map.getCenter().lng)") + zoom = page.evaluate_script("map.getZoom()") + # Wait for any potential asynchronous operations to complete + wait_for_ajax + + assert_equal(-25, lat) + assert_equal(-13, lng) + assert_equal(9, zoom) end test 'url hash updates when map panned' do visit '/map' page.execute_script("map.setView([13, 60], 15)") + url_hash = page.evaluate_script("window.location.hash") + + # Wait for any potential asynchronous operations to complete + wait_for_ajax # check that the url hash is correct - assert_equal("#15/13/60", page.evaluate_script("window.location.hash")) - + assert_equal("#15/13/60", url_hash) end end diff --git a/yarn.lock b/yarn.lock index 8dadb48a6f..3f91e7d8a6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3528,10 +3528,19 @@ leaflet-blurred-location@^1.5.1, leaflet-blurred-location@^1.6.0: jquery "^3.2.1" leaflet "^1.3.3" -leaflet-environmental-layers@^2.1.7: - version "2.1.7" - resolved "https://registry.yarnpkg.com/leaflet-environmental-layers/-/leaflet-environmental-layers-2.1.7.tgz#3d866404929db76b34b68d87460a6f5584bebccc" - integrity sha512-/lNjVMVZQBAydTWnTScWpDIx/1iPBlYp3MKI9sSKnU973Zj72du4VG7BPdlYxC6aPkKa3pHhWYNmk72E69SCSw== +"leaflet-blurred-location@git://github.com/publiclab/leaflet-blurred-location.git#main": + version "1.6.0" + uid ef66dcb768094680e92d4f972b68f18cd4db6ccc + resolved "git://github.com/publiclab/leaflet-blurred-location.git#ef66dcb768094680e92d4f972b68f18cd4db6ccc" + dependencies: + haversine-distance "^1.1.4" + jquery "^3.2.1" + leaflet "^1.3.3" + +leaflet-environmental-layers@^2.1.9: + version "2.1.9" + resolved "https://registry.yarnpkg.com/leaflet-environmental-layers/-/leaflet-environmental-layers-2.1.9.tgz#48487bb7a2489d72411bd4112e00b3f5d21d4a7c" + integrity sha512-ur2ZtF/H17RIkKkTjc5Uhc7A3WAEkc9O2xfaFW1XS7hBiij6nkH1sckHZ9kZmkNFLHC0ifoymUi7n9k7p1VA+g== dependencies: jquery "^3.3.1" leaflet "^1.3.1"