Skip to content
Extraits de code Groupes Projets
Valider 8193978f rédigé par Florian Staudacher's avatar Florian Staudacher
Parcourir les fichiers

in 'standalone' mode, the close button is hidden

... publisher is embedded into something, that has its own close button
parent 452de1b8
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -42,6 +42,12 @@ app.views.Publisher = Backbone.View.extend(_.extend( ...@@ -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);
......
...@@ -4,6 +4,22 @@ ...@@ -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
......
...@@ -16,6 +16,7 @@ describe("bookmarklet", function() { ...@@ -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();
}); });
}); });
......
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