mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06: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);
|
||||
});
|
||||
|
||||
@@ -10,10 +10,6 @@ moduleFor("controller:site-map", "controller:site-map", {
|
||||
}
|
||||
});
|
||||
|
||||
test("itemController", function() {
|
||||
equal(this.subject().get("itemController"), "site-map-category", "defaults to site-map-category");
|
||||
});
|
||||
|
||||
test("showAdminLinks", function() {
|
||||
var currentUserStub = Ember.Object.create();
|
||||
sandbox.stub(Discourse.User, "current").returns(currentUserStub);
|
||||
|
||||
Reference in New Issue
Block a user