openstreetmap-website/test/system/note_layer_test.rb
Nenad Vujicic cc6bfb2c7c Removes first comment body from notes tests
Improves notes unit tests by replacing checking with first comment's body with checking with default / user-specified descriptions. Also, removes test_author unit test, adds setting note's author when checking notification's success and sets first comment type to "opened" in tests with tooltips which require first comment to be "opened".
2025-03-05 19:01:03 +00:00

40 lines
1.6 KiB
Ruby

require "application_system_test_case"
class NoteLayerTest < ApplicationSystemTestCase
test "note marker should have description as a title" do
position = (1.1 * GeoRecord::SCALE).to_i
create(:note, :latitude => position, :longitude => position) do |note|
create(:note_comment, :note => note, :body => "Note description", :event => "opened")
end
visit root_path(:anchor => "map=18/1.1/1.1&layers=N")
all "img.leaflet-marker-icon", :count => 1 do |marker|
assert_equal "Note description", marker["title"]
end
end
test "note marker should not have a title if the note has no visible description" do
position = (1.1 * GeoRecord::SCALE).to_i
create(:note, :latitude => position, :longitude => position) do |note|
create(:note_comment, :note => note, :body => "Note description is hidden", :event => "opened", :visible => false)
create(:note_comment, :note => note, :body => "Note comment visible")
end
visit root_path(:anchor => "map=18/1.1/1.1&layers=N")
all "img.leaflet-marker-icon", :count => 1 do |marker|
assert_equal "", marker["title"]
end
end
test "note marker should not have a title if the note has no visible description and comments" do
position = (1.1 * GeoRecord::SCALE).to_i
create(:note, :latitude => position, :longitude => position) do |note|
create(:note_comment, :note => note, :body => "Note description is hidden", :event => "opened", :visible => false)
end
visit root_path(:anchor => "map=18/1.1/1.1&layers=N")
all "img.leaflet-marker-icon", :count => 1 do |marker|
assert_equal "", marker["title"]
end
end
end