diff --git a/public/javascripts/app/views/publisher_view.js b/public/javascripts/app/views/publisher_view.js index f8c5d87c6..2315b8c3d 100644 --- a/public/javascripts/app/views/publisher_view.js +++ b/public/javascripts/app/views/publisher_view.js @@ -48,6 +48,7 @@ app.views.Publisher = Backbone.View.extend({ // remove photos this.$("#photodropzone").find('li').remove(); + this.$("input[name='photos[]']").remove(); // close publishing area (CSS) this.close(); diff --git a/spec/javascripts/app/views/publisher_view_spec.js b/spec/javascripts/app/views/publisher_view_spec.js index 6704f9b7c..885001ec1 100644 --- a/spec/javascripts/app/views/publisher_view_spec.js +++ b/spec/javascripts/app/views/publisher_view_spec.js @@ -56,5 +56,14 @@ describe("app.views.Publisher", function() { this.view.clear($.Event()); expect(this.view.$("#photodropzone").html()).toBe(""); }) + + it("removes all photo values appended by the photo uploader", function(){ + $(this.view.el).prepend("") + var photoValuesInput = this.view.$("input[name='photos[]']"); + + photoValuesInput.val("3") + this.view.clear($.Event()); + expect(this.view.$("input[name='photos[]']").length).toBe(0); + }) }); });