Merge remote-tracking branch 'upstream/pull/4998'
This commit is contained in:
commit
e189bafa54
2 changed files with 21 additions and 2 deletions
|
@ -118,8 +118,13 @@ OSM.Search = function (map) {
|
|||
|
||||
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);
|
||||
};
|
||||
|
||||
|
|
14
test/system/search_test.rb
Normal file
14
test/system/search_test.rb
Normal file
|
@ -0,0 +1,14 @@
|
|||
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
|
Loading…
Add table
Add a link
Reference in a new issue