diff --git a/app/assets/javascripts/discourse/helpers/topic-status-icons.js.es6 b/app/assets/javascripts/discourse/helpers/topic-status-icons.js.es6 index f13973d3754..80076d725d2 100644 --- a/app/assets/javascripts/discourse/helpers/topic-status-icons.js.es6 +++ b/app/assets/javascripts/discourse/helpers/topic-status-icons.js.es6 @@ -14,9 +14,7 @@ export default Ember.ArrayProxy.extend({ renderIconIf("archived", "lock", "archived"); } - this.forEach(args => { - renderIconIf(...args); - }); + this.forEach(args => renderIconIf(...args)); } }).create({ content: [ diff --git a/app/assets/javascripts/discourse/widgets/topic-status.js.es6 b/app/assets/javascripts/discourse/widgets/topic-status.js.es6 index fd726062100..366fe462a2f 100644 --- a/app/assets/javascripts/discourse/widgets/topic-status.js.es6 +++ b/app/assets/javascripts/discourse/widgets/topic-status.js.es6 @@ -14,8 +14,8 @@ export default createWidget("topic-status", { const result = []; TopicStatusIcons.render(topic, function(name, key) { - const iconArgs = key === "unpinned" ? { class: "unpinned" } : null, - icon = iconNode(name, iconArgs); + const iconArgs = key === "unpinned" ? { class: "unpinned" } : null; + const icon = iconNode(name, iconArgs); const attributes = { title: escapeExpression(I18n.t(`topic_statuses.${key}.help`)) diff --git a/test/javascripts/widgets/topic-status-test.js.es6 b/test/javascripts/widgets/topic-status-test.js.es6 new file mode 100644 index 00000000000..e0ed454fc31 --- /dev/null +++ b/test/javascripts/widgets/topic-status-test.js.es6 @@ -0,0 +1,37 @@ +import { moduleForWidget, widgetTest } from "helpers/widget-test"; +import TopicStatusIcons from "discourse/helpers/topic-status-icons"; + +moduleForWidget("topic-status"); + +widgetTest("basics", { + template: '{{mount-widget widget="topic-status" args=args}}', + beforeEach(store) { + this.set("args", { + topic: store.createRecord("topic", { closed: true }), + disableActions: true + }); + }, + test(assert) { + assert.ok(find(".topic-status .d-icon-lock").length); + } +}); + +widgetTest("extendability", { + template: '{{mount-widget widget="topic-status" args=args}}', + beforeEach(store) { + TopicStatusIcons.addObject([ + "has_accepted_answer", + "check-square-o", + "solved" + ]); + this.set("args", { + topic: store.createRecord("topic", { + has_accepted_answer: true + }), + disableActions: true + }); + }, + test(assert) { + assert.ok(find(".topic-status .d-icon-check-square-o").length); + } +});