Commit b645541d authored by Steffen van Bergerem's avatar Steffen van Bergerem Committed by Benjamin Neff

Update notifications when changing the stream

fixes #6473

closes #7199
parent 8e345c03
......@@ -15,6 +15,7 @@
* Only reload profile header when changing aspect memberships [#7183](https://github.com/diaspora/diaspora/pull/7183)
* Fix visiblity on invitation modal when opening it from the stream [#7191](https://github.com/diaspora/diaspora/pull/7191)
* Add avatar fallback on tags page [#7198](https://github.com/diaspora/diaspora/pull/7198)
* Update notifications when changing the stream [#7199](https://github.com/diaspora/diaspora/pull/7199)
## Features
* Show spinner when loading comments in the stream [#7170](https://github.com/diaspora/diaspora/pull/7170)
......
......@@ -115,6 +115,7 @@ var app = {
// so we use Backbone.history.navigate instead.
var change = Backbone.history.navigate(link.attr("href").substring(1) ,true);
if(change === undefined) { Backbone.history.loadUrl(link.attr("href").substring(1)); }
app.notificationsCollection.fetch();
});
},
......
......@@ -96,4 +96,39 @@ describe("app", function() {
expect(app._changeLocation).toHaveBeenCalledWith("/users/sign_in");
});
});
describe("setupBackboneLinks", function() {
it("calls Backbone.history.start", function() {
spyOn(Backbone.history, "start");
app.setupBackboneLinks();
expect(Backbone.history.start).toHaveBeenCalledWith({pushState: true});
});
context("when clicking a backbone link", function() {
beforeEach(function() {
app.stream = {basePath: function() { return "/stream"; }};
app.notificationsCollection = {fetch: $.noop};
spyOn(Backbone.history, "start");
this.link = $("<a href='/backbone-link' rel='backbone'>");
spec.content().append(this.link);
app.setupBackboneLinks();
});
afterEach(function() {
app.stream = undefined;
});
it("calls Backbone.history.navigate", function() {
spyOn(Backbone.history, "navigate");
this.link.click();
expect(Backbone.history.navigate).toHaveBeenCalledWith("backbone-link", true);
});
it("fetches new notifications", function() {
spyOn(app.notificationsCollection, "fetch");
this.link.click();
expect(app.notificationsCollection.fetch).toHaveBeenCalled();
});
});
});
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment