mirror of
https://github.com/discourse/discourse.git
synced 2025-05-23 06:51:27 +08:00
@ -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: [
|
||||
|
@ -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`))
|
||||
|
37
test/javascripts/widgets/topic-status-test.js.es6
Normal file
37
test/javascripts/widgets/topic-status-test.js.es6
Normal file
@ -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);
|
||||
}
|
||||
});
|
Reference in New Issue
Block a user