Only reload profile header when changing aspect memberships
closes #7183 fixes #7072
This commit is contained in:
parent
3930069e67
commit
a951c40ba0
4 changed files with 30 additions and 1 deletions
|
|
@ -6,6 +6,7 @@
|
|||
## Bug fixes
|
||||
* Fix fetching comments after fetching likes [#7167](https://github.com/diaspora/diaspora/pull/7167)
|
||||
* Hide 'reshare' button on already reshared posts [#7169](https://github.com/diaspora/diaspora/pull/7169)
|
||||
* Only reload profile header when changing aspect memberships [#7183](https://github.com/diaspora/diaspora/pull/7183)
|
||||
|
||||
## Features
|
||||
* Show spinner when loading comments in the stream [#7170](https://github.com/diaspora/diaspora/pull/7170)
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@ app.pages.Profile = app.views.Base.extend({
|
|||
this.streamCollection = _.has(opts, "streamCollection") ? opts.streamCollection : null;
|
||||
this.streamViewClass = _.has(opts, "streamView") ? opts.streamView : null;
|
||||
|
||||
this.model.on("change", this.render, this);
|
||||
this.model.on("sync", this._done, this);
|
||||
|
||||
// bind to global events
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ app.views.ProfileHeader = app.views.Base.extend({
|
|||
initialize: function(opts) {
|
||||
this.photos = _.has(opts, 'photos') ? opts.photos : null;
|
||||
this.contacts = _.has(opts, 'contacts') ? opts.contacts : null;
|
||||
this.model.on("change", this.render, this);
|
||||
$("#mentionModal").on("modal:loaded", this.mentionModalLoaded.bind(this));
|
||||
$("#mentionModal").on("hidden.bs.modal", this.mentionModalHidden);
|
||||
},
|
||||
|
|
|
|||
|
|
@ -11,6 +11,34 @@ describe("app.views.ProfileHeader", function() {
|
|||
loginAs(factory.userAttrs());
|
||||
});
|
||||
|
||||
describe("initialize", function() {
|
||||
it("calls #render when the model changes", function() {
|
||||
spyOn(app.views.ProfileHeader.prototype, "render");
|
||||
this.view.initialize();
|
||||
expect(app.views.ProfileHeader.prototype.render).not.toHaveBeenCalled();
|
||||
this.view.model.trigger("change");
|
||||
expect(app.views.ProfileHeader.prototype.render).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("calls #mentionModalLoaded on modal:loaded", function() {
|
||||
spec.content().append("<div id='mentionModal'></div>");
|
||||
spyOn(app.views.ProfileHeader.prototype, "mentionModalLoaded");
|
||||
this.view.initialize();
|
||||
expect(app.views.ProfileHeader.prototype.mentionModalLoaded).not.toHaveBeenCalled();
|
||||
$("#mentionModal").trigger("modal:loaded");
|
||||
expect(app.views.ProfileHeader.prototype.mentionModalLoaded).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("calls #mentionModalHidden on hidden.bs.modal", function() {
|
||||
spec.content().append("<div id='mentionModal'></div>");
|
||||
spyOn(app.views.ProfileHeader.prototype, "mentionModalHidden");
|
||||
this.view.initialize();
|
||||
expect(app.views.ProfileHeader.prototype.mentionModalHidden).not.toHaveBeenCalled();
|
||||
$("#mentionModal").trigger("hidden.bs.modal");
|
||||
expect(app.views.ProfileHeader.prototype.mentionModalHidden).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
context("#presenter", function() {
|
||||
it("contains necessary elements", function() {
|
||||
expect(this.view.presenter()).toEqual(jasmine.objectContaining({
|
||||
|
|
|
|||
Loading…
Reference in a new issue