Use toggle() to hide the poll creator
This commit is contained in:
parent
77133a4062
commit
e6348aa705
2 changed files with 5 additions and 3 deletions
|
|
@ -202,7 +202,7 @@ app.views.Publisher = Backbone.View.extend({
|
|||
},
|
||||
|
||||
togglePollCreator: function(){
|
||||
this.view_poll_creator.$el.toggleClass('active');
|
||||
this.view_poll_creator.$el.toggle();
|
||||
this.el_input.focus();
|
||||
},
|
||||
|
||||
|
|
@ -419,9 +419,9 @@ app.views.Publisher = Backbone.View.extend({
|
|||
var onlyWhitespaces = ($.trim(this.el_input.val()) === ''),
|
||||
isPhotoAttached = (this.el_photozone.children().length > 0),
|
||||
isValidPoll = this.view_poll_creator.isValidPoll();
|
||||
|
||||
|
||||
// show poll errors
|
||||
this.view_poll_creator.validatePoll();
|
||||
this.view_poll_creator.validatePoll();
|
||||
|
||||
return (!onlyWhitespaces || isPhotoAttached) && isValidPoll && !this.disabled;
|
||||
},
|
||||
|
|
|
|||
|
|
@ -150,6 +150,8 @@ describe("app.views.Publisher", function() {
|
|||
});
|
||||
|
||||
it("disables submitting", function() {
|
||||
this.view.togglePollCreator();
|
||||
|
||||
this.view.setText('TESTING');
|
||||
expect(this.view.el_submit.prop('disabled')).toBeFalsy();
|
||||
expect(this.view.el_preview.prop('disabled')).toBeFalsy();
|
||||
|
|
|
|||
Loading…
Reference in a new issue