From 7b2d020d37f0be749890001ee499faaf549f80b7 Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Tue, 1 Apr 2025 04:10:47 +0300 Subject: [PATCH] Convert zoom to number in OSM.formatHash --- app/assets/javascripts/osm.js.erb | 4 ++-- test/system/fixthemap_test.rb | 11 +++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) create mode 100644 test/system/fixthemap_test.rb diff --git a/app/assets/javascripts/osm.js.erb b/app/assets/javascripts/osm.js.erb index 6762ce6b0..d73d1c163 100644 --- a/app/assets/javascripts/osm.js.erb +++ b/app/assets/javascripts/osm.js.erb @@ -158,11 +158,11 @@ OSM = { layers = args.getLayersCode(); } else if (args instanceof URLSearchParams) { center = args.get("center") || L.latLng(args.get("lat"), args.get("lon")); - zoom = args.get("zoom"); + zoom = Number(args.get("zoom")); layers = args.get("layers") || ""; } else { center = args.center || L.latLng(args.lat, args.lon); - zoom = args.zoom; + zoom = Number(args.zoom); layers = args.layers || ""; } diff --git a/test/system/fixthemap_test.rb b/test/system/fixthemap_test.rb new file mode 100644 index 000000000..77aacdefa --- /dev/null +++ b/test/system/fixthemap_test.rb @@ -0,0 +1,11 @@ +require "application_system_test_case" + +class FixthemapTest < ApplicationSystemTestCase + test "should have 'create a note' link with correct map hash" do + visit fixthemap_path(:lat => 60, :lon => 30, :zoom => 10) + + within_content_body do + assert_link "Add a note to the map", :href => %r{/note/new#map=10/60(\.\d+)?/30(\.\d+)?} + end + end +end -- 2.39.5