From 36f5a073a99f6b1e19ae6c13dea07349c3be4aa6 Mon Sep 17 00:00:00 2001 From: Anton Khorev Date: Sun, 16 Feb 2025 18:00:44 +0300 Subject: [PATCH] Test map panning when visiting changeset and note comment links --- test/system/browse_comment_links_test.rb | 29 ++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 test/system/browse_comment_links_test.rb diff --git a/test/system/browse_comment_links_test.rb b/test/system/browse_comment_links_test.rb new file mode 100644 index 000000000..6c81a928f --- /dev/null +++ b/test/system/browse_comment_links_test.rb @@ -0,0 +1,29 @@ +require "application_system_test_case" + +class BrowseCommentLinksTest < ApplicationSystemTestCase + test "visiting changeset comment link should pan to changeset" do + changeset = create(:changeset, :min_lat => 60 * GeoRecord::SCALE, :min_lon => 30 * GeoRecord::SCALE, + :max_lat => 60 * GeoRecord::SCALE, :max_lon => 30 * GeoRecord::SCALE) + comment = create(:changeset_comment, :changeset => changeset, :body => "Linked changeset comment") + + visit changeset_path(changeset, :anchor => "c#{comment.id}") + + within_sidebar do + assert_text "Linked changeset comment" + end + assert_match %r{map=\d+/60\.\d+/30\.\d+}, current_url + end + + test "visiting note comment link should pan to note" do + note = create(:note, :latitude => 59 * GeoRecord::SCALE, :longitude => 29 * GeoRecord::SCALE) + create(:note_comment, :note => note, :body => "Note description") + comment = create(:note_comment, :note => note, :body => "Linked note comment", :event => "commented") + + visit note_path(note, :anchor => "c#{comment.id}") + + within_sidebar do + assert_text "Linked note comment" + end + assert_match %r{map=\d+/59\.\d+/29\.\d+}, current_url + end +end -- 2.39.5