mirror of
https://github.com/discourse/discourse.git
synced 2025-05-29 22:48:29 +08:00
TWEAK: Sum new and unread in the site map category list
This commit is contained in:
@ -1,12 +1,27 @@
|
||||
moduleFor("controller:site-map-category");
|
||||
|
||||
test("showBadges", function() {
|
||||
sandbox.stub(Discourse.User, "current");
|
||||
var controller = this.subject();
|
||||
|
||||
Discourse.User.current.returns(null);
|
||||
ok(!controller.get("showBadges"), "returns false when no user is logged in");
|
||||
|
||||
Discourse.User.current.returns({});
|
||||
ok(controller.get("showBadges"), "returns true when an user is logged in");
|
||||
moduleFor("controller:site-map-category", 'controller:site-map-category', {
|
||||
needs: ['controller:site-map']
|
||||
});
|
||||
|
||||
test("showTopicCount anonymous", function() {
|
||||
var controller = this.subject();
|
||||
ok(controller.get("showTopicCount"), 'true when anonymous');
|
||||
});
|
||||
|
||||
test("showTopicCount logged in", function() {
|
||||
var controller = this.subject({ currentUser: Discourse.User.create() });
|
||||
ok(!controller.get("showTopicCount"), 'false when logged in');
|
||||
});
|
||||
|
||||
test("unreadTotal default", function() {
|
||||
var controller = this.subject({ currentUser: Discourse.User.create() });
|
||||
ok(!controller.get('unreadTotal'), "empty by default");
|
||||
});
|
||||
|
||||
test("unreadTotal with values", function() {
|
||||
var controller = this.subject({
|
||||
currentUser: Discourse.User.create(),
|
||||
unreadTopics: 1,
|
||||
newTopics: 3
|
||||
});
|
||||
equal(controller.get('unreadTotal'), 4);
|
||||
});
|
||||
|
Reference in New Issue
Block a user