diff --git a/app/views/maps/modals/_feature.haml b/app/views/maps/modals/_feature.haml index 0ea92a3bf..511e64788 100644 --- a/app/views/maps/modals/_feature.haml +++ b/app/views/maps/modals/_feature.haml @@ -49,7 +49,7 @@ %i.bi.bi-download geojson %span.feature-export#feature-export-gpx.ms-2.link< - =link_to map_feature_gpx_path(id: @map.public_id, feature_id: 'feature_id'), target: '_blank', title: 'Download as GPX', 'data-toggle': "tooltip", 'data-bs-placement': "bottom", 'data-bs-trigger': "hover", 'data-bs-custom-class': "maplibregl-ctrl-tooltip" do + =link_to map_feature_gpx_path(id: @map.public_id, feature_id: 'feature_id'), title: 'Download as GPX', 'data-toggle': "tooltip", 'data-bs-placement': "bottom", 'data-bs-trigger': "hover", 'data-bs-custom-class': "maplibregl-ctrl-tooltip" do %i.bi.bi-download gpx / %span#feature-animation.ms-2.link diff --git a/app/views/maps/modals/_share.haml b/app/views/maps/modals/_share.haml index a8f59cfa4..988228907 100644 --- a/app/views/maps/modals/_share.haml +++ b/app/views/maps/modals/_share.haml @@ -60,7 +60,7 @@ %i.bi.bi-download GeoJSON %button.btn.btn-secondary.btn-download{ type: "button" } - =link_to map_gpx_path(@map.public_id), target: '_blank' do + =link_to map_gpx_path(@map.public_id) do %i.bi.bi-download GPX %button.btn.btn-secondary.btn-download{ type: "button" } diff --git a/spec/factories/features.rb b/spec/factories/features.rb index 83bd9c785..cb51138d9 100644 --- a/spec/factories/features.rb +++ b/spec/factories/features.rb @@ -12,6 +12,7 @@ end after :build do |feature, evaluator| + raise 'Specify feature type trait' if feature.geometry.empty? feature.geometry['coordinates'] = evaluator.coordinates if evaluator.coordinates feature.properties['title'] = evaluator.title if evaluator.title feature.properties['desc'] = evaluator.desc if evaluator.desc diff --git a/spec/features/map_share_spec.rb b/spec/features/map_share_spec.rb index 7a71f4c8c..5070e477d 100644 --- a/spec/features/map_share_spec.rb +++ b/spec/features/map_share_spec.rb @@ -51,17 +51,14 @@ context 'export gpx' do subject(:map) { create(:map, user: create(:user), features: features) } - let(:features) { create_list(:feature, 2, :line_string) } + let(:features) { [ create(:feature, :line_string, coordinates: [ [ 11.041, 49.481 ], [ 11.056, 49.463 ] ]), + create(:feature, :line_string, coordinates: [ [ 11.056, 49.463 ], [ 11.061, 49.450 ] ]) ] } before do - visit map.private_map_path - expect_map_loaded - find('.maplibregl-ctrl-share').click - expect(page).to have_text('Share Map') + visit '/m/' + subject.public_id + '.gpx' end it 'exports gpx with one track per linestring' do - click_link("GPX") file = wait_for_download(subject.public_id + '.gpx', timeout: 10) expect(File.read(file).scan(//i).size).to eq(2) end diff --git a/spec/support/map_helpers.rb b/spec/support/map_helpers.rb index 1c209f8ca..31220338f 100644 --- a/spec/support/map_helpers.rb +++ b/spec/support/map_helpers.rb @@ -3,8 +3,8 @@ # * GeoJSON features loaded + drawn # * Websocket is established def expect_map_loaded - expect(page).to have_css("#maplibre-map[data-map-loaded='true']", wait: 45) - expect(page).to have_css("#maplibre-map[data-geojson-loaded='true']", wait: 45) + expect(page).to have_css("#maplibre-map[data-geojson-loaded='true']", wait: 30) + expect(page).to have_css("#maplibre-map[data-map-loaded='true']", wait: 30) expect(page).to have_css("#maplibre-map[data-online='true']") end