avoid posting empty comments
fix Jasmine test updated changelog with bugfix #3836 fix changelog update remove wrong bug fix line
This commit is contained in:
parent
3c9ce435e1
commit
3f3409a0a5
3 changed files with 34 additions and 4 deletions
|
|
@ -1,5 +1,9 @@
|
||||||
# Head
|
# Head
|
||||||
|
|
||||||
|
## Bug fixes
|
||||||
|
|
||||||
|
* avoid posting empty comments. [#3836](https://github.com/diaspora/diaspora/issues/3836)
|
||||||
|
|
||||||
## Refactor
|
## Refactor
|
||||||
|
|
||||||
* Refactor people_controller#show and photos_controller#index [#4002](https://github.com/diaspora/diaspora/issues/4002)
|
* Refactor people_controller#show and photos_controller#index [#4002](https://github.com/diaspora/diaspora/issues/4002)
|
||||||
|
|
@ -57,7 +61,7 @@
|
||||||
* Stream form on profile page [#3910](https://github.com/diaspora/diaspora/issues/3910).
|
* Stream form on profile page [#3910](https://github.com/diaspora/diaspora/issues/3910).
|
||||||
* Add Getting_Started page mobile. [#3949](https://github.com/diaspora/diaspora/issues/3949).
|
* Add Getting_Started page mobile. [#3949](https://github.com/diaspora/diaspora/issues/3949).
|
||||||
* Autoscroll to the first unread message in conversations. [#3216](https://github.com/diaspora/diaspora/issues/3216)
|
* Autoscroll to the first unread message in conversations. [#3216](https://github.com/diaspora/diaspora/issues/3216)
|
||||||
* Friendlier new-conversation mobile. [#3984](https://github.com/diaspora/diaspora/issues/3984)
|
* Friendlier new-conversation mobile. [#3984](https://github.com/diaspora/diaspora/issues/3984)
|
||||||
|
|
||||||
## Bug Fixes
|
## Bug Fixes
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,9 +39,15 @@ app.views.CommentStream = app.views.Base.extend({
|
||||||
|
|
||||||
createComment: function(evt) {
|
createComment: function(evt) {
|
||||||
if(evt){ evt.preventDefault(); }
|
if(evt){ evt.preventDefault(); }
|
||||||
this.model.comment(this.$(".comment_box").val())
|
|
||||||
this.$(".comment_box").val("")
|
var commentText = $.trim(this.$('.comment_box').val());
|
||||||
return this;
|
if(commentText) {
|
||||||
|
this.model.comment(commentText);
|
||||||
|
this.$(".comment_box").val("");
|
||||||
|
return this;
|
||||||
|
} else {
|
||||||
|
this.$(".comment_box").val("").focus();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
appendComment: function(comment) {
|
appendComment: function(comment) {
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,26 @@ describe("app.views.CommentStream", function(){
|
||||||
expect($.fn.autoResize.mostRecentCall.object.selector).toBe("textarea")
|
expect($.fn.autoResize.mostRecentCall.object.selector).toBe("textarea")
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
describe("createComment", function() {
|
||||||
|
beforeEach(function() {
|
||||||
|
jasmine.Ajax.useMock();
|
||||||
|
this.view.render();
|
||||||
|
this.view.expandComments();
|
||||||
|
})
|
||||||
|
|
||||||
|
it("submits the new comment when comment text is not empty", function() {
|
||||||
|
this.view.$(".comment_box").val('a new comment');
|
||||||
|
this.view.createComment();
|
||||||
|
expect(this.view.$(".comment-content p").text()).toEqual("a new comment");
|
||||||
|
})
|
||||||
|
|
||||||
|
it("clears the comment box when there are only spaces", function() {
|
||||||
|
this.view.$(".comment_box").val(' ');
|
||||||
|
this.view.createComment();
|
||||||
|
expect(this.view.$(".comment_box").val()).toEqual("");
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
describe("appendComment", function(){
|
describe("appendComment", function(){
|
||||||
it("appends this.model as 'parent' to the comment", function(){
|
it("appends this.model as 'parent' to the comment", function(){
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue