discourse/test/javascripts/models/user-test.js.es6
Robin Ward 9974a26c47 FEATURE: Can specify a list of default_avatars urls.
These new avatars will be used by new users until they upload their own
avatars. If left blank, letter avatars are used.
2015-03-03 16:19:29 -05:00

28 lines
914 B
JavaScript

module("Discourse.User");
test('staff', function(){
var user = Discourse.User.create({id: 1, username: 'eviltrout'});
ok(!user.get('staff'), "user is not staff");
user.toggleProperty('moderator');
ok(user.get('staff'), "moderators are staff");
user.setProperties({moderator: false, admin: true});
ok(user.get('staff'), "admins are staff");
});
test('searchContext', function() {
var user = Discourse.User.create({id: 1, username: 'EvilTrout'});
deepEqual(user.get('searchContext'), {type: 'user', id: 'eviltrout', user: user}, "has a search context");
});
test("isAllowedToUploadAFile", function() {
var user = Discourse.User.create({ trust_level: 0, admin: true });
ok(user.isAllowedToUploadAFile("image"), "admin can always upload a file");
user.setProperties({ admin: false, moderator: true });
ok(user.isAllowedToUploadAFile("image"), "moderator can always upload a file");
});