diff --git a/Changelog.md b/Changelog.md index a6f9d244e93c913c457d0e282092604b6fd45fe6..7e62922176f85708b6397ec609a5c96d28baf43d 100644 --- a/Changelog.md +++ b/Changelog.md @@ -5,6 +5,7 @@ ## Bug fixes ## Features +* Ask for confirmation when leaving a submittable comment field [#7530](https://github.com/diaspora/diaspora/pull/7530) # 0.7.0.0 diff --git a/app/assets/javascripts/app/views/comment_stream_view.js b/app/assets/javascripts/app/views/comment_stream_view.js index 2a1b816129cb3b08d4f6ac39c9f21dd827d284cf..0401b585a377b4a48e8423422e1a8b370d77732e 100644 --- a/app/assets/javascripts/app/views/comment_stream_view.js +++ b/app/assets/javascripts/app/views/comment_stream_view.js @@ -37,6 +37,8 @@ app.views.CommentStream = app.views.Base.extend({ }.bind(this), onFocus: this.openForm.bind(this) }); + + this.$("form").areYouSure(); }, presenter: function(){ diff --git a/features/desktop/comments.feature b/features/desktop/comments.feature index 0ef2ca6c8fa90ead72b75a946c2a6368b0bf1d2d..2a1afbf5436c3ddf8f2b66546c219a846111a8f4 100644 --- a/features/desktop/comments.feature +++ b/features/desktop/comments.feature @@ -19,6 +19,7 @@ Feature: commenting When I focus the comment field And I fill in the following: | text | is that a poodle? | + And I reject the alert after I follow "My activity" And I press "Comment" Then I should see "is that a poodle?" within ".comment" And I should see "less than a minute ago" within ".comment time" diff --git a/spec/javascripts/app/views/comment_stream_view_spec.js b/spec/javascripts/app/views/comment_stream_view_spec.js index 284b16c7ab2dc13748d94280eeb0ceb8fe79ff2a..2076871cd851f61ee3f7ea2a8408f76f412e9d2a 100644 --- a/spec/javascripts/app/views/comment_stream_view_spec.js +++ b/spec/javascripts/app/views/comment_stream_view_spec.js @@ -92,6 +92,12 @@ describe("app.views.CommentStream", function(){ expect(renderedPreview).toBe("<div class='preview-content'>" + renderedText + "</div>"); expect(renderedPreview).toContain("Alice Awesome"); }); + + it("calls jQuery.AreYouSure()", function() { + spyOn($.fn, "areYouSure"); + this.view.postRenderTemplate(); + expect($.fn.areYouSure).toHaveBeenCalled(); + }); }); describe("createComment", function() {