From dc8aa572709245f6e9bae4ff863dd52501e9c465 Mon Sep 17 00:00:00 2001 From: Daniel Cunha Date: Fri, 23 Jul 2010 19:36:45 -0300 Subject: [PATCH] Fixing duplicated comments problem due to double clicks --- app/views/content_viewer/_comment_form.rhtml | 2 +- features/comment.feature | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/app/views/content_viewer/_comment_form.rhtml b/app/views/content_viewer/_comment_form.rhtml index dcf94df..4ab5d2f 100644 --- a/app/views/content_viewer/_comment_form.rhtml +++ b/app/views/content_viewer/_comment_form.rhtml @@ -37,7 +37,7 @@ <%= required labelled_form_field(_('Title'), text_field(:comment, :title)) %> <%= required labelled_form_field(_('Enter your comment'), text_area(:comment, :body, :rows => 5)) %> <% button_bar do %> - <%= submit_button('add', _('Post comment'), :onclick => "$('confirm').value = 'true'") %> + <%= submit_button('add', _('Post comment'), :onclick => "$('confirm').value = 'true'; this.disabled = true") %> <% end %> <% end %> diff --git a/features/comment.feature b/features/comment.feature index ded21f1..f0d54fc 100644 --- a/features/comment.feature +++ b/features/comment.feature @@ -57,3 +57,14 @@ Feature: comment When I press "Post comment" Then I should see "Title can't be blank" And I should see "Body can't be blank" + + @selenium + Scenario: disable post comment button + Given I am on /booking/article-to-comment + And I fill in "Name" with "Joey Ramone" + And I fill in "e-Mail" with "joey@ramones.com" + And I fill in "Title" with "Hey ho, let's go!" + And I fill in "Enter your comment" with "Hey ho, let's go!" + When I press "Post comment" + Then the "value.Post comment" button should not be enabled + And I should see "Hey ho, let's go" \ No newline at end of file -- libgit2 0.21.2