1 require "application_system_test_case"
3 class NoteLayerTest < ApplicationSystemTestCase
4 test "note marker should have description as a title" do
5 position = (1.1 * GeoRecord::SCALE).to_i
6 create(:note, :latitude => position, :longitude => position) do |note|
7 create(:note_comment, :note => note, :body => "Note description")
10 visit root_path(:anchor => "map=18/1.1/1.1&layers=N")
11 all "img.leaflet-marker-icon", :count => 1 do |marker|
12 assert_equal "Note description", marker["title"]
16 test "note marker should not have a title if the note has no visible description" do
17 position = (1.1 * GeoRecord::SCALE).to_i
18 create(:note, :latitude => position, :longitude => position) do |note|
19 create(:note_comment, :note => note, :body => "Note description is hidden", :visible => false)
20 create(:note_comment, :note => note, :body => "Note comment visible", :event => "commented")
23 visit root_path(:anchor => "map=18/1.1/1.1&layers=N")
24 all "img.leaflet-marker-icon", :count => 1 do |marker|
25 assert_equal "", marker["title"]
29 test "note marker should not have a title if the note has no visible description and comments" do
30 position = (1.1 * GeoRecord::SCALE).to_i
31 create(:note, :latitude => position, :longitude => position) do |note|
32 create(:note_comment, :note => note, :body => "Note description is hidden", :visible => false)
35 visit root_path(:anchor => "map=18/1.1/1.1&layers=N")
36 all "img.leaflet-marker-icon", :count => 1 do |marker|
37 assert_equal "", marker["title"]