diff --git a/app/assets/javascripts/app/views/publisher_view.js b/app/assets/javascripts/app/views/publisher_view.js index e6c5ac336..c8c952f24 100644 --- a/app/assets/javascripts/app/views/publisher_view.js +++ b/app/assets/javascripts/app/views/publisher_view.js @@ -42,6 +42,12 @@ app.views.Publisher = Backbone.View.extend(_.extend( this.el_hiddenInput.val( this.el_input.val() ); } + // hide close button, in case publisher is standalone + // (e.g. bookmarklet, mentions popup) + if( this.options.standalone ) { + this.$('#hide_publisher').hide(); + } + // this has to be here, otherwise for some reason the callback for the // textchange event won't be called in Backbone... this.el_input.bind('textchange', $.noop); diff --git a/spec/javascripts/app/views/publisher_view_spec.js b/spec/javascripts/app/views/publisher_view_spec.js index b1c55e64a..0e301847c 100644 --- a/spec/javascripts/app/views/publisher_view_spec.js +++ b/spec/javascripts/app/views/publisher_view_spec.js @@ -4,6 +4,22 @@ */ describe("app.views.Publisher", function() { + describe("standalone", function() { + beforeEach(function() { + // should be jasmine helper + loginAs({name: "alice", avatar : {small : "http://avatar.com/photo.jpg"}}); + + spec.loadFixture("aspects_index"); + this.view = new app.views.Publisher({ + standalone: true + }); + }); + + it("hides the close button in standalone mode", function() { + expect(this.view.$('#hide_publisher').is(':visible')).toBeFalsy(); + }); + }); + context("plain publisher", function() { beforeEach(function() { // should be jasmine helper diff --git a/spec/javascripts/bookmarklet-spec.js b/spec/javascripts/bookmarklet-spec.js index 57ac4925a..fee57d0e7 100644 --- a/spec/javascripts/bookmarklet-spec.js +++ b/spec/javascripts/bookmarklet-spec.js @@ -16,6 +16,7 @@ describe("bookmarklet", function() { it('verifies we are using the bookmarklet', function(){ expect(app.publisher.options.standalone).toBeTruthy(); + expect(app.publisher.$('#hide_publisher').is(':visible')).toBeFalsy(); }); });