1 # frozen_string_literal: true
3 require "application_system_test_case"
5 class NoteLayerTest < ApplicationSystemTestCase
6 test "note marker should have description as a title" do
7 position = (1.1 * GeoRecord::SCALE).to_i
8 create(:note, :latitude => position, :longitude => position) do |note|
9 create(:note_comment, :note => note, :body => "Note description", :event => "opened")
12 visit root_path(:anchor => "map=18/1.1/1.1&layers=N")
13 all ".leaflet-marker-icon", :count => 1 do |marker|
14 assert_equal "Note description", marker["title"]
18 test "note marker should not have a title if the note has no visible description" do
19 position = (1.1 * GeoRecord::SCALE).to_i
20 create(:note, :latitude => position, :longitude => position) do |note|
21 create(:note_comment, :note => note, :body => "Note description is hidden", :event => "opened", :visible => false)
22 create(:note_comment, :note => note, :body => "Note comment visible")
25 visit root_path(:anchor => "map=18/1.1/1.1&layers=N")
26 all ".leaflet-marker-icon", :count => 1 do |marker|
27 assert_equal "", marker["title"]
31 test "note marker should not have a title if the note has no visible description and comments" do
32 position = (1.1 * GeoRecord::SCALE).to_i
33 create(:note, :latitude => position, :longitude => position) do |note|
34 create(:note_comment, :note => note, :body => "Note description is hidden", :event => "opened", :visible => false)
37 visit root_path(:anchor => "map=18/1.1/1.1&layers=N")
38 all ".leaflet-marker-icon", :count => 1 do |marker|
39 assert_equal "", marker["title"]