]> git.openstreetmap.org Git - rails.git/blob - test/system/note_layer_test.rb
Don't check ids of new notes in create note system tests
[rails.git] / test / system / note_layer_test.rb
1 require "application_system_test_case"
2
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")
8     end
9
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"]
13     end
14   end
15
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")
21     end
22
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"]
26     end
27   end
28
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)
33     end
34
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"]
38     end
39   end
40 end