]> git.openstreetmap.org Git - rails.git/commitdiff
Get note text only from textarea within left sidebar
authorAnton Khorev <tony29@yandex.ru>
Thu, 19 Dec 2024 02:22:54 +0000 (05:22 +0300)
committerAnton Khorev <tony29@yandex.ru>
Thu, 19 Dec 2024 02:22:54 +0000 (05:22 +0300)
app/assets/javascripts/index/note.js
test/system/resolve_note_test.rb

index 8687321c92d3bce115d02c6b8973ffd01ebd9124..e9c51f9bf1df571f6814be4999a10517975fd28b 100644 (file)
@@ -61,7 +61,7 @@ OSM.Note = function (map) {
       };
 
       if (name !== "subscribe" && name !== "unsubscribe" && name !== "reopen") {
-        ajaxSettings.data = { text: $("textarea").val() };
+        ajaxSettings.data = { text: content.find("textarea").val() };
       }
 
       content.find("button[name]").prop("disabled", true);
index 90990dcbd5ed6eae0c71f63c8eefa81d05dd52f5..f9152d99be98c8fdb639e4f44c01bd84c6b91353 100644 (file)
@@ -9,6 +9,7 @@ class ResolveNoteTest < ApplicationSystemTestCase
 
     within_sidebar do
       assert_button "Resolve"
+      assert_no_button "Comment & Resolve"
       assert_no_button "Reactivate"
 
       click_on "Resolve"
@@ -17,6 +18,28 @@ class ResolveNoteTest < ApplicationSystemTestCase
     end
   end
 
+  test "can resolve an open note with a comment" do
+    note = create(:note_with_comments)
+    user = create(:user)
+    sign_in_as(user)
+    visit note_path(note)
+
+    within_sidebar do
+      assert_button "Resolve"
+      assert_no_button "Comment & Resolve"
+      assert_no_button "Reactivate"
+
+      fill_in "text", :with => "Note resolve text"
+
+      assert_button "Comment & Resolve"
+
+      click_on "Comment & Resolve"
+
+      assert_content "Resolved note ##{note.id}"
+      assert_content "Note resolve text"
+    end
+  end
+
   test "can reactivate a closed note" do
     note = create(:note_with_comments, :closed)
     user = create(:user)
@@ -25,6 +48,7 @@ class ResolveNoteTest < ApplicationSystemTestCase
 
     within_sidebar do
       assert_no_button "Resolve"
+      assert_no_button "Comment & Resolve"
       assert_button "Reactivate"
 
       click_on "Reactivate"