diff --git a/app/assets/javascripts/discourse/helpers/category-link.js.es6 b/app/assets/javascripts/discourse/helpers/category-link.js.es6 index 9b6b6caea..9f7d3f4ed 100644 --- a/app/assets/javascripts/discourse/helpers/category-link.js.es6 +++ b/app/assets/javascripts/discourse/helpers/category-link.js.es6 @@ -61,7 +61,9 @@ export function categoryBadgeHTML(category, opts) { href = " href='" + href + "' "; } - return "<" + tagName + " class='badge-wrapper " + Discourse.SiteSettings.category_style + extraClasses + "' " + href + ">" + html + ""; + extraClasses = Discourse.SiteSettings.category_style ? Discourse.SiteSettings.category_style + extraClasses : extraClasses; + + return "<" + tagName + " class='badge-wrapper " + extraClasses + "' " + href + ">" + html + ""; } export function categoryLinkHTML(category, options) { diff --git a/test/javascripts/lib/category-badge-test.js.es6 b/test/javascripts/lib/category-badge-test.js.es6 index 22d76769a..9dbe2f3f7 100644 --- a/test/javascripts/lib/category-badge-test.js.es6 +++ b/test/javascripts/lib/category-badge-test.js.es6 @@ -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');