3 class GeocoderHelperTest < ActionView::TestCase
4 def test_result_to_html
5 html = result_to_html(:lat => 1.23, :lon => 4.56, :zoom => 16, :name => "Name")
6 assert_dom_equal '<a class="set_position" data-lat="1.23" data-lon="4.56" data-zoom="16" data-name="Name" href="/#map=16/1.23/4.56">Name</a>', html
8 html = result_to_html(:lat => 1.23, :lon => 4.56, :zoom => 16, :prefix => "Prefix", :name => "Name")
9 assert_dom_equal 'Prefix <a class="set_position" data-lat="1.23" data-lon="4.56" data-zoom="16" data-prefix="Prefix" data-name="Name" href="/#map=16/1.23/4.56">Name</a>', html
11 html = result_to_html(:lat => 1.23, :lon => 4.56, :zoom => 16, :name => "Name", :suffix => "Suffix")
12 assert_dom_equal '<a class="set_position" data-lat="1.23" data-lon="4.56" data-zoom="16" data-name="Name" data-suffix="Suffix" href="/#map=16/1.23/4.56">Name</a> Suffix', html
14 html = result_to_html(:lat => 1.23, :lon => 4.56, :zoom => 16, :prefix => "Prefix", :name => "Name", :suffix => "Suffix")
15 assert_dom_equal 'Prefix <a class="set_position" data-lat="1.23" data-lon="4.56" data-zoom="16" data-prefix="Prefix" data-name="Name" data-suffix="Suffix" href="/#map=16/1.23/4.56">Name</a> Suffix', html
17 html = result_to_html(:type => "node", :id => 123456, :name => "Name")
18 assert_dom_equal '<a class="set_position" data-type="node" data-id="123456" data-name="Name" href="/node/123456">Name</a>', html
20 html = result_to_html(:min_lat => 1.23, :max_lat => 4.56, :min_lon => -1.23, :max_lon => 2.34, :name => "Name")
21 assert_dom_equal '<a class="set_position" data-min-lat="1.23" data-max-lat="4.56" data-min-lon="-1.23" data-max-lon="2.34" data-name="Name" href="/?bbox=-1.23,1.23,2.34,4.56">Name</a', html