]> git.openstreetmap.org Git - rails.git/commitdiff
Remove note from edit link when it's not a current object
authorAnton Khorev <tony29@yandex.ru>
Wed, 5 Oct 2022 19:58:33 +0000 (22:58 +0300)
committerAnton Khorev <tony29@yandex.ru>
Wed, 5 Oct 2022 19:58:33 +0000 (22:58 +0300)
app/assets/javascripts/application.js
test/system/index_test.rb [new file with mode: 0644]

index 89f60847fb9261f2432051e5c2441b32b96744e9..4f53a0493ceda2ff2e1f812540e636df76d467e5 100644 (file)
@@ -33,6 +33,7 @@ window.updateLinks = function (loc, zoom, layers, object) {
     delete args.way;
     delete args.relation;
     delete args.changeset;
+    delete args.note;
 
     if (object && editlink) {
       args[object.type] = object.id;
diff --git a/test/system/index_test.rb b/test/system/index_test.rb
new file mode 100644 (file)
index 0000000..bb23cee
--- /dev/null
@@ -0,0 +1,21 @@
+require "application_system_test_case"
+
+class IndexTest < ApplicationSystemTestCase
+  test "node included in edit link" do
+    node = create(:node)
+    visit node_path(node)
+    assert_selector "#editanchor[href*='?node=#{node.id}#']"
+
+    find("#sidebar .btn-close").click
+    assert_no_selector "#editanchor[href*='?node=#{node.id}#']"
+  end
+
+  test "note included in edit link" do
+    note = create(:note_with_comments)
+    visit browse_note_path(note)
+    assert_selector "#editanchor[href*='?note=#{note.id}#']"
+
+    find("#sidebar .btn-close").click
+    assert_no_selector "#editanchor[href*='?note=#{note.id}#']"
+  end
+end