]> git.openstreetmap.org Git - rails.git/blobdiff - test/system/index_test.rb
Move close button out of left sidebar content
[rails.git] / test / system / index_test.rb
index 1167797c5b8b85781a91e479fa21553c6cc22b6b..8352cdd1c5ee7a010ecb645a88341d90796b3f83 100644 (file)
@@ -1,6 +1,41 @@
 require "application_system_test_case"
 
 class IndexTest < ApplicationSystemTestCase
 require "application_system_test_case"
 
 class IndexTest < ApplicationSystemTestCase
+  test "should remove and add an overlay on share button click" do
+    node = create(:node)
+    visit node_path(node)
+    assert_selector "#content.overlay-right-sidebar"
+    find(".icon.share").click
+    assert_no_selector "#content.overlay-right-sidebar"
+    find(".icon.share").click
+    assert_selector "#content.overlay-right-sidebar"
+  end
+
+  test "should add an overlay on close" do
+    node = create(:node)
+    visit node_path(node)
+    find(".icon.share").click
+    assert_no_selector "#content.overlay-right-sidebar"
+    find(".share-ui .btn-close").click
+    assert_selector "#content.overlay-right-sidebar"
+  end
+
+  test "should not add overlay when not closing right menu popup" do
+    node = create(:node)
+    visit node_path(node)
+    find(".icon.share").click
+
+    find(".icon.key").click
+    assert_no_selector "#content.overlay-right-sidebar"
+    find(".icon.layers").click
+    assert_no_selector "#content.overlay-right-sidebar"
+    find(".icon.key").click
+    assert_no_selector "#content.overlay-right-sidebar"
+
+    find(".icon.key").click
+    assert_selector "#content.overlay-right-sidebar"
+  end
+
   test "node included in edit link" do
     node = create(:node)
     visit node_path(node)
   test "node included in edit link" do
     node = create(:node)
     visit node_path(node)
@@ -12,7 +47,7 @@ class IndexTest < ApplicationSystemTestCase
 
   test "note included in edit link" do
     note = create(:note_with_comments)
 
   test "note included in edit link" do
     note = create(:note_with_comments)
-    visit browse_note_path(note)
+    visit note_path(note)
     assert_selector "#editanchor[href*='?note=#{note.id}#']"
 
     find("#sidebar .btn-close").click
     assert_selector "#editanchor[href*='?note=#{note.id}#']"
 
     find("#sidebar .btn-close").click
@@ -21,20 +56,20 @@ class IndexTest < ApplicationSystemTestCase
 
   test "can navigate from hidden note to visible note" do
     sign_in_as(create(:moderator_user))
 
   test "can navigate from hidden note to visible note" do
     sign_in_as(create(:moderator_user))
-    hidden_note = create(:note, :status => "hidden")
-    create(:note_comment, :note => hidden_note, :body => "this-is-a-hidden-note")
+    hidden_note = create(:note, :status => "hidden", :description => "Hidden Note Description")
+    create(:note_comment, :note => hidden_note, :body => "this-is-a-hidden-note", :event => "opened")
     position = (1.003 * GeoRecord::SCALE).to_i
     position = (1.003 * GeoRecord::SCALE).to_i
-    visible_note = create(:note, :latitude => position, :longitude => position)
-    create(:note_comment, :note => visible_note, :body => "this-is-a-visible-note")
+    visible_note = create(:note, :latitude => position, :longitude => position, :description => "Visible Note Description")
+    create(:note_comment, :note => visible_note, :body => "this-is-a-visible-note", :event => "opened")
 
 
-    visit root_path(:anchor => "map=15/1/1") # view place of hidden note in case it is not rendered during browse_note_path(hidden_note)
-    visit browse_note_path(hidden_note)
+    visit root_path(:anchor => "map=15/1/1") # view place of hidden note in case it is not rendered during note_path(hidden_note)
+    visit note_path(hidden_note)
     find(".leaflet-control.control-layers .control-button").click
     find("#map-ui .overlay-layers .form-check-label", :text => "Map Notes").click
     visible_note_marker = find(".leaflet-marker-icon[title=this-is-a-visible-note]")
     find(".leaflet-control.control-layers .control-button").click
     find("#map-ui .overlay-layers .form-check-label", :text => "Map Notes").click
     visible_note_marker = find(".leaflet-marker-icon[title=this-is-a-visible-note]")
-    assert_selector "#sidebar", :text => "this-is-a-hidden-note"
+    assert_selector "#sidebar", :text => "Hidden Note Description"
 
     visible_note_marker.click
 
     visible_note_marker.click
-    assert_selector "#sidebar", :text => "this-is-a-visible-note"
+    assert_selector "#sidebar", :text => "Visible Note Description"
   end
 end
   end
 end