correct tests and implemenation

This commit is contained in:
Sam Saffron 2015-12-15 19:46:00 +11:00
parent b7f6df7d0c
commit dd6e38133a
2 changed files with 2 additions and 2 deletions

View file

@ -82,7 +82,7 @@ Discourse.Utilities = {
var classes = "avatar" + (options.extraClasses ? " " + options.extraClasses : "");
var title = (options.title) ? " title='" + Handlebars.Utils.escapeExpression(options.title || "") + "'" : "";
return "<img alt='" + (title || "avatar") + "' width='" + size + "' height='" + size + "' src='" + Discourse.getURLWithCDN(url) + "' class='" + classes + "'" + title + ">";
return "<img alt='" + (options.title || "avatar") + "' width='" + size + "' height='" + size + "' src='" + Discourse.getURLWithCDN(url) + "' class='" + classes + "'" + title + ">";
},
tinyAvatar: function(avatarTemplate, options) {

View file

@ -130,7 +130,7 @@ test("avatarImg", function() {
"it returns the avatar html");
equal(utils.avatarImg({avatarTemplate: avatarTemplate, size: 'tiny', title: 'evilest trout'}),
"<img alt='avatar' width='20' height='20' src='/path/to/avatar/40.png' class='avatar' title='evilest trout'>",
"<img alt='evilest trout' width='20' height='20' src='/path/to/avatar/40.png' class='avatar' title='evilest trout'>",
"it adds a title if supplied");
equal(utils.avatarImg({avatarTemplate: avatarTemplate, size: 'tiny', extraClasses: 'evil fish'}),