correct tests

This commit is contained in:
Sam 2015-01-29 17:57:34 +11:00
parent 1a694c04e4
commit a591c019d4
2 changed files with 5 additions and 3 deletions

View file

@ -61,7 +61,9 @@ export function categoryBadgeHTML(category, opts) {
href = " href='" + href + "' ";
}
return "<" + tagName + " class='badge-wrapper " + Discourse.SiteSettings.category_style + extraClasses + "' " + href + ">" + html + "</" + tagName + ">";
extraClasses = Discourse.SiteSettings.category_style ? Discourse.SiteSettings.category_style + extraClasses : extraClasses;
return "<" + tagName + " class='badge-wrapper " + extraClasses + "' " + href + ">" + html + "</" + tagName + ">";
}
export function categoryLinkHTML(category, options) {

View file

@ -16,8 +16,8 @@ test("Regular categoryBadge", function() {
}),
tag = parseHTML(categoryBadgeHTML(category))[0];
equal(tag.name, 'span', 'it creates a `span` wrapper tag');
equal(tag.attributes['class'], 'badge-wrapper', 'it has the correct class');
equal(tag.name, 'a', 'it creates a `a` wrapper tag');
equal(tag.attributes['class'].trim(), 'badge-wrapper', 'it has the correct class');
var label = tag.children[1];
equal(label.attributes.title, 'cool description', 'it has the correct title');