in 'standalone' mode, the close button is hidden

... publisher is embedded into something, that has its own close button
This commit is contained in:
Florian Staudacher 2012-09-17 20:46:33 +02:00
parent 452de1b866
commit 8193978fd2
3 changed files with 23 additions and 0 deletions

View file

@ -42,6 +42,12 @@ app.views.Publisher = Backbone.View.extend(_.extend(
this.el_hiddenInput.val( this.el_input.val() ); 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 // this has to be here, otherwise for some reason the callback for the
// textchange event won't be called in Backbone... // textchange event won't be called in Backbone...
this.el_input.bind('textchange', $.noop); this.el_input.bind('textchange', $.noop);

View file

@ -4,6 +4,22 @@
*/ */
describe("app.views.Publisher", function() { 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() { context("plain publisher", function() {
beforeEach(function() { beforeEach(function() {
// should be jasmine helper // should be jasmine helper

View file

@ -16,6 +16,7 @@ describe("bookmarklet", function() {
it('verifies we are using the bookmarklet', function(){ it('verifies we are using the bookmarklet', function(){
expect(app.publisher.options.standalone).toBeTruthy(); expect(app.publisher.options.standalone).toBeTruthy();
expect(app.publisher.$('#hide_publisher').is(':visible')).toBeFalsy();
}); });
}); });