Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/views/maps/modals/_feature.haml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion app/views/maps/modals/_share.haml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down
1 change: 1 addition & 0 deletions spec/factories/features.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 3 additions & 6 deletions spec/features/map_share_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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(/<trk>/i).size).to eq(2)
end
Expand Down
4 changes: 2 additions & 2 deletions spec/support/map_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down