Merge pull request #7518 from svbergerem/fix-7245
Prevent publisher from closing in preview mode
This commit is contained in:
commit
05a4bf262a
3 changed files with 28 additions and 2 deletions
|
|
@ -30,6 +30,7 @@ If so, please delete it since it will prevent the federation from working proper
|
|||
* Fix height too high on mobile SPV [#7480](https://github.com/diaspora/diaspora/pull/7480)
|
||||
* Improve stream when ignoring a person who posts a lot of tagged posts [#7503](https://github.com/diaspora/diaspora/pull/7503)
|
||||
* Fix order of comments across pods [#7436](https://github.com/diaspora/diaspora/pull/7436)
|
||||
* Prevent publisher from closing in preview mode [#7518](https://github.com/diaspora/diaspora/pull/7518)
|
||||
|
||||
## Features
|
||||
* Add support for mentions in comments to the backend [#6818](https://github.com/diaspora/diaspora/pull/6818)
|
||||
|
|
|
|||
|
|
@ -407,8 +407,8 @@ app.views.Publisher = Backbone.View.extend({
|
|||
},
|
||||
|
||||
tryClose : function(){
|
||||
// if it is not submittable, close it.
|
||||
if( !this._submittable() ){
|
||||
// if it is not submittable and not in preview mode, close it.
|
||||
if (!this._submittable() && !this.markdownEditor.isPreviewMode()) {
|
||||
this.close();
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -252,6 +252,31 @@ describe("app.views.Publisher", function() {
|
|||
});
|
||||
});
|
||||
|
||||
describe("tryClose", function() {
|
||||
it("doesn't close the publisher if it is submittable", function() {
|
||||
spyOn(this.view, "_submittable").and.returnValue(true);
|
||||
spyOn(this.view, "close");
|
||||
this.view.tryClose();
|
||||
expect(this.view.close).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("doesn't close the publisher if it is in preview mode", function() {
|
||||
spyOn(this.view, "_submittable").and.returnValue(false);
|
||||
spyOn(this.view.markdownEditor, "isPreviewMode").and.returnValue(true);
|
||||
spyOn(this.view, "close");
|
||||
this.view.tryClose();
|
||||
expect(this.view.close).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("closes the publisher if it is neither submittable nor in preview mode", function() {
|
||||
spyOn(this.view, "_submittable").and.returnValue(false);
|
||||
spyOn(this.view.markdownEditor, "isPreviewMode").and.returnValue(false);
|
||||
spyOn(this.view, "close");
|
||||
this.view.tryClose();
|
||||
expect(this.view.close).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
describe("_beforeUnload", function(){
|
||||
it("calls _submittable", function(){
|
||||
spyOn(this.view, "_submittable");
|
||||
|
|
|
|||
Loading…
Reference in a new issue