Commit ef4cb47fd60a5db1641a4a906816d7097322a603
Exists in
staging
and in
42 other branches
Merge commit 'refs/merge-requests/344' of git://gitorious.org/noosfero/noosfero …
…into merge-requests/344
Showing
3 changed files
with
19 additions
and
7 deletions
Show diff stats
features/comment.feature
| @@ -84,3 +84,10 @@ Feature: comment | @@ -84,3 +84,10 @@ Feature: comment | ||
| 84 | When I press "Post comment" | 84 | When I press "Post comment" |
| 85 | Then the "Title" field should contain "Joey Ramone" | 85 | Then the "Title" field should contain "Joey Ramone" |
| 86 | And I should see "Body can't be blank" | 86 | And I should see "Body can't be blank" |
| 87 | + | ||
| 88 | + @selenium | ||
| 89 | + Scenario: wrong comment doesn't increment comment counter | ||
| 90 | + Given I am on /booking/article-with-comment | ||
| 91 | + And I follow "Post a comment" | ||
| 92 | + When I press "Post comment" | ||
| 93 | + And I should see "2 comments" |
features/step_definitions/noosfero_steps.rb
| @@ -287,8 +287,8 @@ end | @@ -287,8 +287,8 @@ end | ||
| 287 | Given /^I am logged in as "(.+)"$/ do |username| | 287 | Given /^I am logged in as "(.+)"$/ do |username| |
| 288 | Given %{I go to logout page} | 288 | Given %{I go to logout page} |
| 289 | And %{I go to login page} | 289 | And %{I go to login page} |
| 290 | - And %{I fill in "Username" with "#{username}"} | ||
| 291 | - And %{I fill in "Password" with "123456"} | 290 | + And %{I fill in "main_user_login" with "#{username}"} |
| 291 | + And %{I fill in "user_password" with "123456"} | ||
| 292 | When %{I press "Log in"} | 292 | When %{I press "Log in"} |
| 293 | # FIXME: | 293 | # FIXME: |
| 294 | # deveria apenas verificar que esta no myprofile do usuario | 294 | # deveria apenas verificar que esta no myprofile do usuario |
public/javascripts/comment_form.js
| @@ -54,6 +54,7 @@ function save_comment(button) { | @@ -54,6 +54,7 @@ function save_comment(button) { | ||
| 54 | $('#'+ data.render_target).replaceWith(data.html); | 54 | $('#'+ data.render_target).replaceWith(data.html); |
| 55 | $('#' + data.render_target).effect("highlight", {}, 3000); | 55 | $('#' + data.render_target).effect("highlight", {}, 3000); |
| 56 | $.colorbox.close(); | 56 | $.colorbox.close(); |
| 57 | + update_comment_count(); | ||
| 57 | } else { | 58 | } else { |
| 58 | //New comment of article | 59 | //New comment of article |
| 59 | comment_div.find('.article-comments-list').append(data.html); | 60 | comment_div.find('.article-comments-list').append(data.html); |
| @@ -64,13 +65,9 @@ function save_comment(button) { | @@ -64,13 +65,9 @@ function save_comment(button) { | ||
| 64 | 65 | ||
| 65 | page_comment_form.find('.errorExplanation').remove(); | 66 | page_comment_form.find('.errorExplanation').remove(); |
| 66 | $.colorbox.close(); | 67 | $.colorbox.close(); |
| 68 | + update_comment_count(); | ||
| 67 | } | 69 | } |
| 68 | 70 | ||
| 69 | - comment_div.find('.comment-count').add('#article-header .comment-count').each(function() { | ||
| 70 | - var count = parseInt($(this).html()); | ||
| 71 | - update_comment_count($(this), count + 1); | ||
| 72 | - }); | ||
| 73 | - | ||
| 74 | if(jQuery('#recaptcha_response_field').val()){ | 71 | if(jQuery('#recaptcha_response_field').val()){ |
| 75 | Recaptcha.reload(); | 72 | Recaptcha.reload(); |
| 76 | } | 73 | } |
| @@ -86,6 +83,14 @@ function save_comment(button) { | @@ -86,6 +83,14 @@ function save_comment(button) { | ||
| 86 | }, 'json'); | 83 | }, 'json'); |
| 87 | } | 84 | } |
| 88 | 85 | ||
| 86 | +function update_comment_count() { | ||
| 87 | + comment_div.find('.comment-count').add('#article-header .comment-count').each(function() { | ||
| 88 | + var count = parseInt($(this).html()); | ||
| 89 | + update_comment_count($(this), count + 1); | ||
| 90 | + }); | ||
| 91 | + | ||
| 92 | +} | ||
| 93 | + | ||
| 89 | function show_display_comment_button() { | 94 | function show_display_comment_button() { |
| 90 | if(jQuery('.post_comment_box.opened').length==0) | 95 | if(jQuery('.post_comment_box.opened').length==0) |
| 91 | jQuery('.display-comment-form').show(); | 96 | jQuery('.display-comment-form').show(); |