From f2ea7fd95e31a3677dc766a574bccaf4038dfcf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juanjo=20Baza=CC=81n?= Date: Thu, 13 Aug 2015 18:27:16 +0200 Subject: [PATCH] fixes bug that hides comment form after reply Closes #160 --- app/assets/javascripts/comments.js.coffee | 6 +++--- spec/features/comments_spec.rb | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/comments.js.coffee b/app/assets/javascripts/comments.js.coffee index 452b706e7..0831d8a20 100644 --- a/app/assets/javascripts/comments.js.coffee +++ b/app/assets/javascripts/comments.js.coffee @@ -4,10 +4,10 @@ App.Comments = $(response_html).insertAfter($("#js-comment-form-#{parent_id}")) reset_and_hide_form: (id) -> - form = $("#js-comment-form-#{id} form") - input = form.find("textarea") + form_container = $("#js-comment-form-#{id}") + input = form_container.find("form textarea") input.val('') - form.hide() + form_container.hide() reset_form: (id) -> input = $("#js-comment-form-#{id} form textarea") diff --git a/spec/features/comments_spec.rb b/spec/features/comments_spec.rb index 5417bb48a..77444cf61 100644 --- a/spec/features/comments_spec.rb +++ b/spec/features/comments_spec.rb @@ -70,7 +70,7 @@ feature 'Comments' do expect(page).to have_content 'It will be done next week.' end - expect(page).to have_selector("#js-comment-form-comment_#{comment.id}", visible: true) + expect(page).to_not have_selector("#js-comment-form-comment_#{comment.id}", visible: true) end scenario "N replies", :js do