FEATURE: User Bookmarks Menu

This commit is contained in:
Arpit Jalan
2014-06-11 14:53:38 +05:30
parent e129e4a19e
commit aed2483bb9
9 changed files with 34 additions and 7 deletions

View File

@ -1,4 +1,10 @@
module("Discourse.UserDropdownController");
var controller;
module("controller:user-dropdown", {
setup: function() {
controller = testController('user-dropdown');
}
});
test("logout action logs out the current user", function () {
var logout_mock = sinon.mock(Discourse, "logout");
@ -14,10 +20,20 @@ test("showAdminLinks", function() {
var currentUserStub = Ember.Object.create();
this.stub(Discourse.User, "current").returns(currentUserStub);
var controller = controllerFor('user-dropdown');
currentUserStub.set("staff", true);
equal(controller.get("showAdminLinks"), true, "is true when current user is a staff member");
currentUserStub.set("staff", false);
equal(controller.get("showAdminLinks"), false, "is false when current user is not a staff member");
});
test("showBookmarksLink", function() {
var currentUserStub = Ember.Object.create();
this.stub(Discourse.User, "current").returns(currentUserStub);
currentUserStub.set("hasBookmark", true);
equal(controller.get("showBookmarksLink"), true, "is true when current user have bookmarks");
currentUserStub.set("hasBookmark", false);
equal(controller.get("showBookmarksLink"), false, "is false when current user does not have bookmarks");
});