1 # frozen_string_literal: true
3 require "application_system_test_case"
5 class IndexTest < ApplicationSystemTestCase
6 test "should remove and add an overlay on share button click" do
11 assert_selector "#content.overlay-right-sidebar"
17 assert_no_selector "#content.overlay-right-sidebar"
23 assert_selector "#content.overlay-right-sidebar"
26 test "should add an overlay on close" do
35 assert_no_selector "#content.overlay-right-sidebar"
41 assert_selector "#content.overlay-right-sidebar"
44 test "should not add overlay when not closing right menu popup" do
54 assert_no_selector "#content.overlay-right-sidebar"
60 assert_no_selector "#content.overlay-right-sidebar"
66 assert_no_selector "#content.overlay-right-sidebar"
72 assert_selector "#content.overlay-right-sidebar"
75 test "node included in edit link" do
78 assert_selector "#editanchor[href*='?node=#{node.id}#']"
80 find("#sidebar .btn-close").click
81 assert_no_selector "#editanchor[href*='?node=#{node.id}#']"
84 test "note included in edit link" do
85 note = create(:note_with_comments)
87 assert_selector "#editanchor[href*='?note=#{note.id}#']"
89 find("#sidebar .btn-close").click
90 assert_no_selector "#editanchor[href*='?note=#{note.id}#']"
93 test "can navigate from hidden note to visible note" do
94 sign_in_as(create(:moderator_user))
95 hidden_note = create(:note, :status => "hidden", :description => "Hidden Note Description")
96 create(:note_comment, :note => hidden_note, :body => "this-is-a-hidden-note", :event => "opened")
97 position = (1.003 * GeoRecord::SCALE).to_i
98 visible_note = create(:note, :latitude => position, :longitude => position, :description => "Visible Note Description")
99 create(:note_comment, :note => visible_note, :body => "this-is-a-visible-note", :event => "opened")
101 visit root_path(:anchor => "map=15/1/1") # view place of hidden note in case it is not rendered during note_path(hidden_note)
102 visit note_path(hidden_note)
112 assert_text "Hidden Note Description"
115 visible_note_marker = find(".leaflet-marker-icon[title=this-is-a-visible-note]")
116 visible_note_marker.click
119 assert_text "Visible Note Description"