]> git.openstreetmap.org Git - rails.git/blob - test/system/browse_comment_links_test.rb
Merge remote-tracking branch 'upstream/pull/5923'
[rails.git] / test / system / browse_comment_links_test.rb
1 require "application_system_test_case"
2
3 class BrowseCommentLinksTest < ApplicationSystemTestCase
4   test "visiting changeset comment link should pan to changeset" do
5     changeset = create(:changeset, :bbox => [30, 60, 30, 60])
6     comment = create(:changeset_comment, :changeset => changeset, :body => "Linked changeset comment")
7
8     visit changeset_path(changeset, :anchor => "c#{comment.id}")
9
10     within_sidebar do
11       assert_text "Linked changeset comment"
12     end
13     assert_match %r{map=\d+/60\.\d+/30\.\d+}, current_url
14   end
15
16   test "visiting note comment link should pan to note" do
17     note = create(:note, :latitude => 59 * GeoRecord::SCALE, :longitude => 29 * GeoRecord::SCALE)
18     create(:note_comment, :note => note, :body => "Note description")
19     comment = create(:note_comment, :note => note, :body => "Linked note comment", :event => "commented")
20
21     visit note_path(note, :anchor => "c#{comment.id}")
22
23     within_sidebar do
24       assert_text "Linked note comment"
25     end
26     assert_match %r{map=\d+/59\.\d+/29\.\d+}, current_url
27   end
28 end