UX: Change category badge style to use stripes

This commit is contained in:
Robin Ward
2015-01-20 11:36:28 -05:00
parent f3c9310e12
commit 350554e198
27 changed files with 175 additions and 211 deletions

View File

@ -2,46 +2,6 @@ module("Discourse.HTML");
var html = Discourse.HTML;
test("categoryBadge without a category", function() {
blank(html.categoryBadge(), "it returns no HTML");
});
test("Regular categoryBadge", function() {
var category = Discourse.Category.create({
name: 'hello',
id: 123,
description_text: 'cool description',
color: 'ff0',
text_color: 'f00'
}),
tag = parseHTML(html.categoryBadge(category))[0];
equal(tag.name, 'a', 'it creates an `a` tag');
equal(tag.attributes['class'], 'badge-category', 'it has the correct class');
equal(tag.attributes.title, 'cool description', 'it has the correct title');
ok(tag.attributes.style.indexOf('#ff0') !== -1, "it has the color style");
ok(tag.attributes.style.indexOf('#f00') !== -1, "it has the textColor style");
equal(tag.children[0].data, 'hello', 'it has the category name');
});
test("undefined color", function() {
var noColor = Discourse.Category.create({ name: 'hello', id: 123 }),
tag = parseHTML(html.categoryBadge(noColor))[0];
blank(tag.attributes.style, "it has no color style because there are no colors");
});
test("allowUncategorized", function() {
var uncategorized = Discourse.Category.create({name: 'uncategorized', id: 345});
sandbox.stub(Discourse.Site, 'currentProp').withArgs('uncategorized_category_id').returns(345);
blank(html.categoryBadge(uncategorized), "it doesn't return HTML for uncategorized by default");
present(html.categoryBadge(uncategorized, {allowUncategorized: true}), "it returns HTML");
});
test("customHTML", function() {
blank(html.getCustomHTML('evil'), "there is no custom HTML for a key by default");