Update parent comment responses count when a new reply is created
Extract the needed portion of code to a new partial to be able to update only the elements needed when a new comment is added keeping UI properly updated.
This commit is contained in:
@@ -238,6 +238,21 @@ describe "Commenting proposals" do
|
||||
expect(page).not_to have_selector("#js-comment-form-comment_#{comment.id}", visible: true)
|
||||
end
|
||||
|
||||
scenario "Reply update parent comment responses count", :js do
|
||||
comment = create(:comment, commentable: proposal)
|
||||
|
||||
login_as(create(:user))
|
||||
visit proposal_path(proposal)
|
||||
|
||||
within ".comment", text: comment.body do
|
||||
click_link "Reply"
|
||||
fill_in "Leave your comment", with: "It will be done next week."
|
||||
click_button "Publish reply"
|
||||
|
||||
expect(page).to have_content("1 response (collapse)")
|
||||
end
|
||||
end
|
||||
|
||||
scenario "Errors on reply", :js do
|
||||
comment = create(:comment, commentable: proposal, user: user)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user