Fix comment cancel button url (#1508)
This commit is contained in:
parent
b4384867ad
commit
8f348f9831
4 changed files with 12 additions and 4 deletions
|
|
@ -45,9 +45,9 @@
|
|||
<input class="uploaded-image" id="uploaded-image-main" />
|
||||
</div>
|
||||
<div class="actions" id="submit-wrapper">
|
||||
<a href="<%=commentable.path%>">
|
||||
<button id="cancel-button" class="comment-action-button comment-action-cancel">CANCEL</button>
|
||||
</a>
|
||||
<%= link_to request.referer.present? ? :back : commentable.path do %>
|
||||
<button id="cancel-button" class="comment-action-button comment-action-cancel">CANCEL</button>
|
||||
<% end %>
|
||||
<button id="preview-button" class="comment-action-button comment-action-preview">PREVIEW</button>
|
||||
<%= f.submit "SUBMIT", id: "submit-button", onclick:"validateField(event)", class:"comment-action-button" %>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -4,9 +4,9 @@ RSpec.describe "Editing A Comment", type: :feature, js: true do
|
|||
let(:user) { create(:user) }
|
||||
let!(:article) { create(:article, show_comments: true) }
|
||||
let(:new_comment_text) { Faker::Lorem.paragraph }
|
||||
let!(:comment) { create(:comment, commentable: article, user: user, body_markdown: Faker::Lorem.paragraph) }
|
||||
|
||||
before do
|
||||
comment = create(:comment, commentable: article, user: user, body_markdown: Faker::Lorem.paragraph)
|
||||
Notification.send_new_comment_notifications(comment)
|
||||
sign_in user
|
||||
end
|
||||
|
|
@ -34,4 +34,12 @@ RSpec.describe "Editing A Comment", type: :feature, js: true do
|
|||
assert_updated
|
||||
end
|
||||
end
|
||||
|
||||
context "when user edits via direct path (no referer)" do
|
||||
it "cancels to the article page" do
|
||||
user.reload
|
||||
visit "#{comment.path}/edit"
|
||||
expect(page).to have_link("CANCEL", href: article.path.to_s)
|
||||
end
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Reference in a new issue