Commit dc8aa572709245f6e9bae4ff863dd52501e9c465

Authored by Daniel Cunha
Committed by Joenio Costa
1 parent ede05a1f

Fixing duplicated comments problem due to double clicks

  * Disabling submit button after click

(ActionItem1420)
app/views/content_viewer/_comment_form.rhtml
... ... @@ -37,7 +37,7 @@
37 37 <%= required labelled_form_field(_('Title'), text_field(:comment, :title)) %>
38 38 <%= required labelled_form_field(_('Enter your comment'), text_area(:comment, :body, :rows => 5)) %>
39 39 <% button_bar do %>
40   - <%= submit_button('add', _('Post comment'), :onclick => "$('confirm').value = 'true'") %>
  40 + <%= submit_button('add', _('Post comment'), :onclick => "$('confirm').value = 'true'; this.disabled = true") %>
41 41 <% end %>
42 42 <% end %>
43 43  
... ...
features/comment.feature
... ... @@ -57,3 +57,14 @@ Feature: comment
57 57 When I press "Post comment"
58 58 Then I should see "Title can't be blank"
59 59 And I should see "Body can't be blank"
  60 +
  61 + @selenium
  62 + Scenario: disable post comment button
  63 + Given I am on /booking/article-to-comment
  64 + And I fill in "Name" with "Joey Ramone"
  65 + And I fill in "e-Mail" with "joey@ramones.com"
  66 + And I fill in "Title" with "Hey ho, let's go!"
  67 + And I fill in "Enter your comment" with "Hey ho, let's go!"
  68 + When I press "Post comment"
  69 + Then the "value.Post comment" button should not be enabled
  70 + And I should see "Hey ho, let's go"
60 71 \ No newline at end of file
... ...