mirror of
https://github.com/discourse/discourse.git
synced 2025-05-24 03:01:25 +08:00
Lots of work on tests
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
module("controller:header", "Header Controller");
|
||||
moduleFor("controller:header", "controller:header");
|
||||
|
||||
test("showNotifications action", function() {
|
||||
var resolveRequestWith;
|
||||
@ -6,17 +6,15 @@ test("showNotifications action", function() {
|
||||
resolveRequestWith = resolve;
|
||||
});
|
||||
|
||||
|
||||
var controller = controllerFor('header');
|
||||
var controller = this.subject();
|
||||
var viewSpy = {
|
||||
showDropdownBySelector: sinon.spy()
|
||||
};
|
||||
this.stub(Discourse, "ajax").withArgs("/notifications").returns(request);
|
||||
this.stub(Discourse.User, "current").returns(Discourse.User.create({
|
||||
sandbox.stub(Discourse, "ajax").withArgs("/notifications").returns(request);
|
||||
sandbox.stub(Discourse.User, "current").returns(Discourse.User.create({
|
||||
unread_notifications: 1
|
||||
}));
|
||||
|
||||
|
||||
Ember.run(function() {
|
||||
controller.send("showNotifications", viewSpy);
|
||||
});
|
||||
@ -25,7 +23,6 @@ test("showNotifications action", function() {
|
||||
equal(Discourse.User.current().get("unread_notifications"), 1, "current user's unread notifications count is not zeroed before data has finished loading");
|
||||
ok(viewSpy.showDropdownBySelector.calledWith("#user-notifications"), "dropdown with loading glyph is shown before data has finished loading");
|
||||
|
||||
|
||||
Ember.run(function() {
|
||||
resolveRequestWith(["notification"]);
|
||||
});
|
||||
|
Reference in New Issue
Block a user