Merge remote-tracking branch 'upstream/pull/5419'
This commit is contained in:
commit
5ce51e9748
4 changed files with 117 additions and 53 deletions
|
@ -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);
|
||||
|
|
|
@ -4,20 +4,24 @@ class CreateNoteTest < ApplicationSystemTestCase
|
|||
test "can create note" do
|
||||
visit new_note_path(:anchor => "map=18/0/0")
|
||||
|
||||
assert_button "Add Note", :disabled => true
|
||||
within_sidebar do
|
||||
assert_button "Add Note", :disabled => true
|
||||
|
||||
fill_in "text", :with => "Some newly added note description"
|
||||
click_on "Add Note"
|
||||
fill_in "text", :with => "Some newly added note description"
|
||||
click_on "Add Note"
|
||||
|
||||
assert_content "Unresolved note ##{Note.last.id}"
|
||||
assert_content "Some newly added note description"
|
||||
assert_content "Unresolved note ##{Note.last.id}"
|
||||
assert_content "Some newly added note description"
|
||||
end
|
||||
end
|
||||
|
||||
test "cannot create note when api is readonly" do
|
||||
with_settings(:status => "api_readonly") do
|
||||
visit new_note_path(:anchor => "map=18/0/0")
|
||||
|
||||
assert_no_button "Add Note", :disabled => true
|
||||
within_sidebar do
|
||||
assert_no_button "Add Note", :disabled => true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -80,52 +80,6 @@ class NoteCommentsTest < ApplicationSystemTestCase
|
|||
end
|
||||
end
|
||||
|
||||
test "can't resolve a note when blocked" do
|
||||
note = create(:note_with_comments)
|
||||
user = create(:user)
|
||||
sign_in_as(user)
|
||||
visit note_path(note)
|
||||
create(:user_block, :user => user)
|
||||
|
||||
within_sidebar do
|
||||
assert_text "Unresolved note"
|
||||
assert_no_text "Resolved note"
|
||||
assert_no_text "Your access to the API has been blocked"
|
||||
assert_button "Resolve", :disabled => false
|
||||
assert_button "Comment", :disabled => true
|
||||
|
||||
click_on "Resolve"
|
||||
|
||||
assert_text "Unresolved note"
|
||||
assert_no_text "Resolved note"
|
||||
assert_text "Your access to the API has been blocked"
|
||||
assert_button "Resolve", :disabled => false
|
||||
assert_button "Comment", :disabled => true
|
||||
end
|
||||
end
|
||||
|
||||
test "can't reactivate a note when blocked" do
|
||||
note = create(:note_with_comments, :closed)
|
||||
user = create(:user)
|
||||
sign_in_as(user)
|
||||
visit note_path(note)
|
||||
create(:user_block, :user => user)
|
||||
|
||||
within_sidebar do
|
||||
assert_no_text "Unresolved note"
|
||||
assert_text "Resolved note"
|
||||
assert_no_text "Your access to the API has been blocked"
|
||||
assert_button "Reactivate", :disabled => false
|
||||
|
||||
click_on "Reactivate"
|
||||
|
||||
assert_no_text "Unresolved note"
|
||||
assert_text "Resolved note"
|
||||
assert_text "Your access to the API has been blocked"
|
||||
assert_button "Reactivate", :disabled => false
|
||||
end
|
||||
end
|
||||
|
||||
test "no subscribe button when not logged in" do
|
||||
note = create(:note_with_comments)
|
||||
visit note_path(note)
|
||||
|
|
106
test/system/resolve_note_test.rb
Normal file
106
test/system/resolve_note_test.rb
Normal file
|
@ -0,0 +1,106 @@
|
|||
require "application_system_test_case"
|
||||
|
||||
class ResolveNoteTest < ApplicationSystemTestCase
|
||||
test "can resolve an open note" 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"
|
||||
|
||||
click_on "Resolve"
|
||||
|
||||
assert_content "Resolved note ##{note.id}"
|
||||
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)
|
||||
sign_in_as(user)
|
||||
visit note_path(note)
|
||||
|
||||
within_sidebar do
|
||||
assert_no_button "Resolve"
|
||||
assert_no_button "Comment & Resolve"
|
||||
assert_button "Reactivate"
|
||||
|
||||
click_on "Reactivate"
|
||||
|
||||
assert_content "Unresolved note ##{note.id}"
|
||||
assert_no_content "<iframe" # leak from share textarea
|
||||
end
|
||||
end
|
||||
|
||||
test "can't resolve a note when blocked" do
|
||||
note = create(:note_with_comments)
|
||||
user = create(:user)
|
||||
sign_in_as(user)
|
||||
visit note_path(note)
|
||||
create(:user_block, :user => user)
|
||||
|
||||
within_sidebar do
|
||||
assert_text "Unresolved note"
|
||||
assert_no_text "Resolved note"
|
||||
assert_no_text "Your access to the API has been blocked"
|
||||
assert_button "Resolve", :disabled => false
|
||||
assert_button "Comment", :disabled => true
|
||||
|
||||
click_on "Resolve"
|
||||
|
||||
assert_text "Unresolved note"
|
||||
assert_no_text "Resolved note"
|
||||
assert_text "Your access to the API has been blocked"
|
||||
assert_button "Resolve", :disabled => false
|
||||
assert_button "Comment", :disabled => true
|
||||
end
|
||||
end
|
||||
|
||||
test "can't reactivate a note when blocked" do
|
||||
note = create(:note_with_comments, :closed)
|
||||
user = create(:user)
|
||||
sign_in_as(user)
|
||||
visit note_path(note)
|
||||
create(:user_block, :user => user)
|
||||
|
||||
within_sidebar do
|
||||
assert_no_text "Unresolved note"
|
||||
assert_text "Resolved note"
|
||||
assert_no_text "Your access to the API has been blocked"
|
||||
assert_button "Reactivate", :disabled => false
|
||||
|
||||
click_on "Reactivate"
|
||||
|
||||
assert_no_text "Unresolved note"
|
||||
assert_text "Resolved note"
|
||||
assert_text "Your access to the API has been blocked"
|
||||
assert_button "Reactivate", :disabled => false
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue