From 18aeeb052bb59baa84336f8c6f00b01cf3e68c2a Mon Sep 17 00:00:00 2001 From: pestrada Date: Sun, 3 Mar 2013 17:50:00 -0600 Subject: [PATCH] reset comment box height after posting a comment refactor create comment method --- Changelog.md | 1 + app/assets/javascripts/app/views/comment_stream_view.js | 5 +++-- spec/javascripts/app/views/comment_stream_view_spec.js | 6 ++++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Changelog.md b/Changelog.md index e6e771799..2b0562179 100644 --- a/Changelog.md +++ b/Changelog.md @@ -2,6 +2,7 @@ ## Bug fixes +* reset comment box height after posting a comment. [#4030](https://github.com/diaspora/diaspora/issues/4030) * fade long tag names. [#3899](https://github.com/diaspora/diaspora/issues/3899) * avoid posting empty comments. [#3836](https://github.com/diaspora/diaspora/issues/3836) * Delegate parent_author to the target of a RelayableRetraction diff --git a/app/assets/javascripts/app/views/comment_stream_view.js b/app/assets/javascripts/app/views/comment_stream_view.js index 24d0ebfab..c2e74b120 100644 --- a/app/assets/javascripts/app/views/comment_stream_view.js +++ b/app/assets/javascripts/app/views/comment_stream_view.js @@ -41,12 +41,13 @@ app.views.CommentStream = app.views.Base.extend({ if(evt){ evt.preventDefault(); } var commentText = $.trim(this.$('.comment_box').val()); + this.$(".comment_box").val(""); + this.$(".comment_box").css("height", ""); if(commentText) { this.model.comment(commentText); - this.$(".comment_box").val(""); return this; } else { - this.$(".comment_box").val("").focus(); + this.$(".comment_box").focus(); } }, diff --git a/spec/javascripts/app/views/comment_stream_view_spec.js b/spec/javascripts/app/views/comment_stream_view_spec.js index a84cbdb81..e78990b82 100644 --- a/spec/javascripts/app/views/comment_stream_view_spec.js +++ b/spec/javascripts/app/views/comment_stream_view_spec.js @@ -47,6 +47,12 @@ describe("app.views.CommentStream", function(){ this.view.createComment(); expect(this.view.$(".comment_box").val()).toEqual(""); }) + + it("resets comment box height", function() { + this.view.$(".comment_box").val('a new comment'); + this.view.createComment(); + expect(this.view.$(".comment_box").attr("style")).not.toContain("height"); + }) }) describe("appendComment", function(){