mirror of
https://github.com/discourse/discourse.git
synced 2025-05-24 01:14:12 +08:00
correct tests and implemenation
This commit is contained in:
@ -82,7 +82,7 @@ Discourse.Utilities = {
|
|||||||
var classes = "avatar" + (options.extraClasses ? " " + options.extraClasses : "");
|
var classes = "avatar" + (options.extraClasses ? " " + options.extraClasses : "");
|
||||||
var title = (options.title) ? " title='" + Handlebars.Utils.escapeExpression(options.title || "") + "'" : "";
|
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) {
|
tinyAvatar: function(avatarTemplate, options) {
|
||||||
|
@ -130,7 +130,7 @@ test("avatarImg", function() {
|
|||||||
"it returns the avatar html");
|
"it returns the avatar html");
|
||||||
|
|
||||||
equal(utils.avatarImg({avatarTemplate: avatarTemplate, size: 'tiny', title: 'evilest trout'}),
|
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");
|
"it adds a title if supplied");
|
||||||
|
|
||||||
equal(utils.avatarImg({avatarTemplate: avatarTemplate, size: 'tiny', extraClasses: 'evil fish'}),
|
equal(utils.avatarImg({avatarTemplate: avatarTemplate, size: 'tiny', extraClasses: 'evil fish'}),
|
||||||
|
Reference in New Issue
Block a user