2013-08-27 17:01:35 -04:00
|
|
|
var avatarSelector = Em.Object.create({
|
|
|
|
use_uploaded_avatar: false,
|
|
|
|
gravatar_template: "//www.gravatar.com/avatar/c6e17f2ae2a215e87ff9e878a4e63cd9.png?s={size}&r=pg&d=identicon",
|
|
|
|
uploaded_avatar_template: "//cdn.discourse.org/uploads/meta_discourse/avatars/093/607/185cff113e/{size}.jpg"
|
|
|
|
});
|
|
|
|
|
2014-05-05 13:58:45 -04:00
|
|
|
module("Discourse.AvatarSelectorController");
|
2013-08-27 17:01:35 -04:00
|
|
|
|
|
|
|
test("avatarTemplate", function() {
|
2014-05-05 13:58:45 -04:00
|
|
|
var avatarSelectorController = testController(Discourse.AvatarSelectorController);
|
2013-08-27 17:01:35 -04:00
|
|
|
avatarSelectorController.setProperties(avatarSelector);
|
|
|
|
|
|
|
|
equal(avatarSelectorController.get("avatarTemplate"),
|
|
|
|
avatarSelector.get("gravatar_template"),
|
|
|
|
"we are using gravatar by default");
|
|
|
|
|
2013-09-16 14:08:55 -04:00
|
|
|
avatarSelectorController.send('useUploadedAvatar');
|
2013-08-27 17:01:35 -04:00
|
|
|
|
|
|
|
equal(avatarSelectorController.get("avatarTemplate"),
|
|
|
|
avatarSelector.get("uploaded_avatar_template"),
|
|
|
|
"calling useUploadedAvatar switches to using the uploaded avatar");
|
|
|
|
|
2013-09-16 14:08:55 -04:00
|
|
|
avatarSelectorController.send('useGravatar');
|
2013-08-27 17:01:35 -04:00
|
|
|
|
|
|
|
equal(avatarSelectorController.get("avatarTemplate"),
|
|
|
|
avatarSelector.get("gravatar_template"),
|
|
|
|
"calling useGravatar switches to using gravatar");
|
|
|
|
});
|