page.pushstate = page.popstate = function (path) {
var params = Qs.parse(path.substring(path.indexOf("?") + 1));
- $(".search_form input[name=query]").val(params.query);
- $(".describe_location").hide();
+ if (params.query) {
+ $(".search_form input[name=query]").val(params.query);
+ $(".describe_location").hide();
+ } else if (params.lat && params.lon) {
+ $(".search_form input[name=query]").val(params.lat + ", " + params.lon);
+ $(".describe_location").hide();
+ }
OSM.loadSidebarContent(path, page.load);
};
--- /dev/null
+require "application_system_test_case"
+
+class SearchTest < ApplicationSystemTestCase
+ test "click on 'where is this' sets search input value" do
+ stub_request(:get, %r{^https://nominatim\.openstreetmap\.org/reverse\?})
+ .to_return(:status => 404)
+
+ visit "/#map=7/1.234/6.789"
+
+ assert_field "Search", :with => ""
+ click_on "Where is this?"
+ assert_field "Search", :with => "1.234, 6.789"
+ end
+end