Skip to content
Extraits de code Groupes Projets
Valider 3f3409a0 rédigé par pestrada's avatar pestrada
Parcourir les fichiers

avoid posting empty comments

fix Jasmine test

updated changelog with bugfix #3836

fix changelog update

remove wrong bug fix line
parent 3c9ce435
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
# Head
## Bug fixes
* avoid posting empty comments. [#3836](https://github.com/diaspora/diaspora/issues/3836)
## Refactor
* 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).
* 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)
* 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
......
......@@ -39,9 +39,15 @@ app.views.CommentStream = app.views.Base.extend({
createComment: function(evt) {
if(evt){ evt.preventDefault(); }
this.model.comment(this.$(".comment_box").val())
this.$(".comment_box").val("")
return this;
var commentText = $.trim(this.$('.comment_box').val());
if(commentText) {
this.model.comment(commentText);
this.$(".comment_box").val("");
return this;
} else {
this.$(".comment_box").val("").focus();
}
},
appendComment: function(comment) {
......
......@@ -28,6 +28,26 @@ describe("app.views.CommentStream", function(){
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(){
it("appends this.model as 'parent' to the comment", function(){
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter